Reading the SCCM Client GUID

Recently I encountered an issue with the SCCM client GUID missing from the  %windir%\SMSCFG.INI file. We wanted to write a script to put the GUID back, so I was asked how to read the SCCM Client GUID from a script or command line.

VBScript:

Set objWMIService = GetObject("winmgmts:\\.\root\ccm")

Set colItems = objWMIService.ExecQuery("Select ClientID From CCM_Client")

For Each objItem in colItems
Wscript.Echo "Client ID" & objItem.ClientID
Next

WMIC via commandline:
wmic /namespace:\\root\ccm path ccm_client get clientid
PowerShell:
Get-WMIObject -namespace root\ccm ccm_client clientid | Select-Object clientid

Suggested Reading:

Comments

Anonymous said…
this is great

Popular posts from this blog

SMS "Program failed (run time exceeded)" 10070

SMS "Waiting for User Condition" 10036

SMS "Waiting for content" 10035