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 "rootCCMpolicymachineactualconfig". 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 "rootCCMpolicymachineactualconfig" -computername $strComputer -Credential $cred

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

Output :

image

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

Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+Email this to someoneShare on TumblrPin on PinterestDigg thisShare on RedditFlattr the authorBuffer this pageShare on StumbleUpon

About Christopher Keyaert

Christopher Keyaert is a Consultant, focused on helping partners to leverage the System Center and Microsoft Azure cloud platform. He is also a Microsoft Most Valuable Professional (MVP) for Cloud and Data Center Management and a Microsoft Certified Trainer (MCT).
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *