Compile a list of servers, may be using another powershell script querying your AD container for servers.
The script below also does a ping test. To be honest, ping test doesn't really tell me if wmi query is going to work.
#$erroractionpreference = "SilentlyContinue"
$serverlist = Get-content 'C:\temp\Serverslist.txt.txt'
Foreach ($server in $serverlist)
if((test-connection -computername $server -count 1 -ea 0 -quiet) -eq $true)
$serveros = Get-wmiobject -class win32_operatingsystem -computername $server
foreach ($objserver in $serveros)
$server + "; " +$objserver.caption + "; " + $objserver.ServicePackMajorVersion