vNext.be | Operations Manager, Opalis, PowerShell, …

CAT | SCCM

Dec/11

19

SCCM 2007 : Get Service Window with PowerShell / WMI

Hi,

Just a quick post to show you how to retrieve SCCM Client Service Window directly from a PowerShell script. The script is really simple, it queries the class CCM_ServiceWindow in the namespace "root\CCM\policy\machine\actualconfig". This script must be executed directly on a SCCM Client computer.

Script :

$strComputer = "SCCMClient.contoso.com"
$Username = "Administrator"
$Password = "P@$$w0rd"

$cred = New-Object System.Management.Automation.PSCredential -ArgumentList @($username,(ConvertTo-SecureString -String $password -AsPlainText -Force))
$List = get-wmiobject -class "CCM_ServiceWindow" -namespace "root\CCM\policy\machine\actualconfig" -computername $strComputer -Credential $cred

foreach($item in $list)
    {
    Write-Host $item.ServiceWindowID
    }

Output :

image

Cheers
Christopher KEYAERT
http://twitter.com/keyaertc

· · · ·

Christopher Keyaert
Copyright 2010 © vNext.be