Export Ping status of set of Computers


Get-Content C:\Users\gsmcwl2\Desktop\computers.txt | ForEach-Object{
$pingstatus = “”
IF (Test-Connection -BufferSize 32 -Count 1 -ComputerName $_ -Quiet) {
$pingstatus = “Online”
} Else {
$pingstatus = “Offline”
}

New-Object -TypeName PSObject -Property @{
Computer = $_
Status = $pingstatus }
} | Export-Csv C:\Users\gsmcwl2\Desktop\PingStatus.csv -NoTypeInformation -Encoding UTF8

Advertisements
%d bloggers like this: