Friday, 5 October 2012

PowerShell - Get the assigned site code for an SCCM Agent.

Below is a useful PowerShell code snippet that I just worked out today. In the output of some of my scripts to view the current configuration of SCCM agent remotely I wanted to display the current assigned site code. In this example I am calling the getassignedsite code WMI method however this same code line could be reused for any of the methods in the class.

$([WmiClass]"\\ComputerName\ROOT\ccm:SMS_Client").getassignedsite() | Select sSiteCode


Available "SMS_Client" class Methods:

  • ResetPolicy
  • RequestMachinePolicy
  • EvaluateMachinePolicy
  • TriggerSchedule
  • RepairClient
  • SetAssignedSite
  • GetAssignedSite
  • SetGlobalLoggingConfiguration
  • ResetGlobalLoggingConfiguration
  • SetClientProvisioningMode
  • PDPMaintenanceTask


Ben

No comments:

Post a Comment