Skip to content

Instantly share code, notes, and snippets.

@martin9700
Created January 12, 2014 20:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save martin9700/8390407 to your computer and use it in GitHub Desktop.
Save martin9700/8390407 to your computer and use it in GitHub Desktop.
$Results = ForEach ($Destination in $Destinations)
{ ForEach ($Source in $Sources)
{ Try {
Write-Host "." -NoNewline
Get-WmiObject "Win32_PingStatus" -ComputerName $Source -Filter "Address = '$Destination'" -ErrorAction Stop | Select PSComputerName,Address,IPV4Address,StatusCode
}
Catch {
Write-Warning "Error with $Source`: $($Error[0])"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment