Ping Status Script
Posted by Superadmin on January 28 2023 15:49:45

Ping Status Script

 

 

$ServerName = get-content "Provide list of servers in .txt format"
$smtp = "Provide SMTP IP"
$to = "To Address"
$from = "From Address"
$sub = " Server Status"
$body = @"
"@
foreach ($Server in $ServerName) {

                    if (test-Connection -ComputerName $Server -Count 4 -Quiet ) { 

                        $body += write-output "$Server is alive and Pinging `n" 

 

                            } else { $body += Write-output "$Server seems dead not pinging `n" }    
        

}
$body
send-MailMessage -SmtpServer $smtp -To $to -Subject $sub -Body $body  -From $from