Tutorial - How To Ping Servers or workstations In Command Prompt
This tutorial shows you how to ping servers or workstations so that you check their connectivity through PowerShell.
$ServerName = Get-Content -path C:\temp\Servers2Ping.txt
$Result = foreach ($Server in $ServerName) {
[PSCustomObject]@{
Server = $Server
Ping = Test-Connection -ComputerName $Server -Count 1 -Quiet
}
}
$Result
$Result | Export-Csv -Path C:\Temp\ServerPing.CSV -NoTypeInformation