Category Archives: sccm

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