Get the SCCM client version, site code and management point
Read the SCCM client version, the assigned site code and the current management point from a local or remote computer with CIM.
LanguagePowerShell
What it does to the systemReads only. It changes nothing.
A client does not report, or it sits in the wrong site. The first facts you need are its version, its site code and its management point.
This script reads all three from the root\ccm namespace. It works on this computer or on a remote one.
PowerShell
<#
Get SCCM client version, site code and management point.
Run it as an administrator. A remote computer needs WinRM turned on.
Example: .\Get-CcmClientInfo.ps1 -ComputerName PC01, PC02
#>
param(
[string[]]$ComputerName = $env:COMPUTERNAME
)
foreach ($computer in $ComputerName) {
$cim = @{ Namespace = 'root\ccm'; ErrorAction = 'Stop' }
# Only add -ComputerName for a remote computer. The local call does not need WinRM.
if ($computer -notin @($env:COMPUTERNAME, 'localhost', '.')) { $cim.ComputerName = $computer }
$row = [ordered]@{ ComputerName = $computer; ClientVersion = ''; SiteCode = ''; ManagementPoint = ''; Error = '' }
try {
$client = Get-CimInstance @cim -ClassName SMS_Client
$row.ClientVersion = $client.ClientVersion
$site = Invoke-CimMethod @cim -ClassName SMS_Client -MethodName GetAssignedSite
$row.SiteCode = $site.sSiteCode
$authority = Get-CimInstance @cim -ClassName SMS_Authority | Select-Object -First 1
$row.ManagementPoint = $authority.CurrentManagementPoint
}
catch {
# "Invalid namespace" here means the SCCM client is not installed.
$row.Error = $_.Exception.Message
}
[pscustomobject]$row
}
How to use it
- Save the script as
Get-CcmClientInfo.ps1. - Open PowerShell as an administrator.
- Run
.\Get-CcmClientInfo.ps1for this computer. - Add
-ComputerName PC01, PC02for remote computers. You need local administrator rights on them. - Add
| Export-Csv C:\Temp\clients.csv -NoTypeInformationto save the result.
Good to know
- An empty management point means the client has not found one yet. Look at
LocationServices.log. - An "Invalid namespace" error means the computer has no SCCM client, or WMI is damaged.
client version
site code
management point
SMS_Client
SMS_Authority