Um den Site Code (Standortcode) eines SCCM Clients auszulesen, kann man WMI verwenden. Ich habe dafür ein kleines PowerShell Script geschrieben:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <# .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:") } |
Downloaden könnt ihr das Skript hier!
Schreibe einen Kommentar...