Powershell script to ping a list of servers or IP Addresses

Powershell script to ping a list of servers or IP Addresses

Powershell script to ping a list of servers or IP Addresses

Below script can be used as a Powershell script to ping a list of servers or IP Addresses


$ServerName = Get-Content "C:\Users\vb\Desktop\computerslist.txt"

foreach ($Server in $ServerName) { if (test-Connection -ComputerName $Server -Count 2 -Quiet ) { "$Server is Pinging " } else {"$Server not pinging" } }

For Example the Computerslist Text file can have one entry on each line like below having either PC name or IP Addresses

pc1.domain.com
pc2.domain.com
10.100.128.10

Results will be like below for above text file.

pc1.domain.com is Pinging
pc2.domain.com is Pinging
10.100.128.10 is Pinging

- No Comments on this Post -

Leave a Reply

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