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:
MSDN Article on How to Get the Unique Identifier Value for a Client (Includes Code Snippets)
About the Author
Emmanuel Tsouris is a Systems Management veteran and Developer Advocate specializing in PowerShell and Cloud Automation. He maintains DotVBS to preserve legacy knowledge for the "archaeologist admin."
Ready to move from VBScript to the Cloud? Check out his book, Pro PowerShell for Amazon Web Services.
Visit EmmanuelTsouris.com for his latest projects.
As an Amazon Associate, I earn from qualifying purchases at no cost to you.
Comments