It`s simple when you know how ! Operating Systems,Tech,Tutorials,Windows,Windows server ping multiple IP for Testing Network disconnecting Issue

ping multiple IP for Testing Network disconnecting Issue

Sometime you can have network disconnecting or disrupting for short period of time, a simple ping test will help a lot to diagnose the issue. PING with log example (without echo to screen):

Ping.exe -t google.com | ForEach {"{0} - {1}" -f (Get-Date),$_} > C:\tmp\ping-log.txt

A PING with output to Screen:

Ping.exe -t google.com | ForEach-Object {"{0} - {1}" -f (Get-Date),$_} | Tee-Object C:\tmp\ping-log.txt -Append

A greate tool I have found at nirsoft will cover all your ping needs including email on failure and multiple servers pinging :

Here is the script of sending email:

$Username = "YourMailUser";
$Password = "YourMailPassword";
$SendTo = "sendto@yourdomain.com";
$MailServer = "mail.yourdomain.com";
$HostName = $args[0];
$IPAddress = $args[1];
$PingStatus = $args[2];
$FailedOn = $args[3];

$message = new-object Net.Mail.MailMessage;
$message.From = $Username;
$message.To.Add($SendTo);
$message.Subject = "Failed Ping On $HostName" ;
$message.Body = "Information about the failed ping: `r`nHost Name: $HostName`r`nIP Address: $IPAddress`r`nPing Status: $PingStatus`r`nPing Time: $FailedOn";

$smtp = new-object Net.Mail.SmtpClient($MailServer, "587");
$smtp.EnableSSL = $true;
$smtp.Credentials = New-Object System.Net.NetworkCredential($Username, $Password);
$smtp.send($message);

Save this as Powershell script and use it as needed (set your own settings in it)’ in this example “send_message_failed_ping.ps1”

You can download the utility from here(local copy of the util , may be out of date) :

https://www.nirsoft.net/utils/multiple_ping_tool.html direct link: https://www.nirsoft.net/utils/pinginfoview.zip

Good Luck

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post