Script to ping a list of computer names

A few weeks ago, I co-worker asked for a script to ping a list of computer names. I thought I had one on my blog, but couldn’t find it. I decided to post a copy here to make it easier to find in the future. This is very simple, and doesn’t do any sort of multithreading, but for a short list it will get the job done pretty quick:

[cc lang=”powershell”]
$ping = New-Object
Get-Content someComputerList.txt | %{
try {$results = $ping.Send($_).Status } catch { $results = $false }
New-Object psobject -Property @{ Name=$_ ; Results=$results }

This entry was posted in Scripting. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *