Finding SCCM client health of windows servers

Below is powershell script you can use to find healthcheck of SCCM clients on servers remotely-

$comp = get-content serverlist.txt

$strFileResults = “sccmclientstatus.txt”

$strOffLinePCs = “offlineservers.txt”

$skipped = @()

$comp | foreach {

$Global:currentpc = $_

if (Test-Connection $currentpc -Quiet -Count 1)
{
$status = get-service -ComputerName $currentpc | where-object { $_.Name -eq “CcmExec”} |
ForEach-Object { $_.status}

$strLine = $currentpc + “,” + $status

$strLine | Out-File $strFileResults -append

Write-Host $currentpc”,”$status

}
else
{
$skipped += $currentpc
}

}

$skipped | Out-File $strOffLinePCs

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s