Wednesday, April 29, 2020

PowerShell Script to Ping Multiple Computers


Ping Multiple computers

This PowerShell Script will get the Computer Name from a Text file, Is located at C:\temp\clients.txt
It will initiated the test connection to all computers and will display the success result.
If any connection gets fail, will store the Failure result on C:\temp\error.txt.

Here is the Script .

$clients=Get-Content C:\temp\clients.txt
foreach ($servers in $clients)
{
try { Test-Connection -ComputerName $servers -Count 1 -ErrorAction Stop  }

catch { $_.exception|Out-File C:\temp\error.txt -Append

}
}

Script View :


Error Log will be as below .

Featured post

System-preferred multifactor authentication (MFA)

Popular Posts