powershell script to ping a list of servers

Clear2all Professional Blog new

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 … Read the rest