Don Jones’ Favorite PowerShell Cmdlets, Part 8 of 10: Ping-Computer
This one’s a cmdlet from the SAPIEN Extensions for Windows PowerShell, a freebie that you can download from www.PrimalScript.com (click on “Free tools” in the left-hand menu area to find it). Pipe in a collection of computer names or addresses:
Gc c:\computers.txt | Ping-Computer
And you’ll get back objects with response times, whether or not each was responding, and so forth. Because they’re objects, they’re usable in the pipeline:
Click past the fold for more…
Gc c:\computers.txt | Ping-Computer | where { $_.Responding } | % { gwmi win32_operatingsystem -comp $_.Computer }
That’ll ping a list of computers and retrieve the OS information from the ones that respond - very cool. I wrote that snap-in myself, and occasionally update it, so be sure to read the accompanying doc file (or ask for Help with the cmdlet) to double-check things like property names - I change ‘em from time to time ;).
Don Jones is the Lead Scripting Guru for SAPIEN Technologies and a Windows PowerShell MVP. He’s the co-author of Windows PowerShell: TFM, 2nd Edition and is the Windows PowerShell columnist for TechNet Magazine. Don is also the Director for the new centralized, independent PowerShell online community: www.PowerShellCommunity.org.
Get your hands on the full Don Jones Favorite Cmdlets Series at this address:
http://www.realtime-windowsserver.com/type/mt-search.cgi?tag=don%20jones%20favorite%20cmdlets&blog_id=1

Email This!
Digg it!
Del.icio.us
Reddit!
Newsvine