Um den Site Code (Standortcode) eines SCCM Clients auszulesen, kann man WMI verwenden. Ich habe dafür ein kleines PowerShell Script geschrieben:
PowerShell
<# .Synopsis Returns the Site Code of a SCCM Client as a String .DESCRIPTION Queries a given computer using WMI and returns its site code for System Center Configuration Manager (Tested on 2012 R2 and 1511) .EXAMPLE Get-SMSSiteCode -MachineName PC1 Get's the site code of the Computer named PC1 #>
Function Get-SMSSiteCode
{
Param(
# The Computername of the machine that you want to query for it's SCCM Site Code
[Parameter(Mandatory=$true)]
[string]$MachineName
)
Return (Get-WmiObject -ComputerName $MachineName `
-Namespace "root\CCM" `
-Class sms_authority `
).Name.TrimStart("SMS:")
}