Tesco value network monitor

Ok, this isn’t really a network monitor, but it is “free” ‘cos it’s written in powershell.

Essentially, it just loops using test-connection against a list servers (literally just a plaintext file, one server per line with no punctuation).

test-connection is easier than using powershell’s “Ping” command because actually, you need to latch onto errors which is hard in ping (example: “Destination host unreachable” is a valid ping response, not an error).

Also, you need to wrap left- and- right chevrons around the email addresses below, but I can’t type them because that’s HTML code…


do {

get-content c:\Support\Scripts\server_list.txt | Foreach-Object {

$Result = test-connection $_ -Quiet

if ($Result -eq $False)
#Define hub transport server
$smtp_server = “you-mail-server-your-domain.com”

#Define email sender and recipient
$sender = “Your Sender your.sender@yourdomain.com
$recipient = “Your Recipient your.recipient@yourdomain.com

#Define email subject and body
$msg_subject = “Important! Server $ComputerName is not responding to ping requests”
$msg_body_text = “Server $ComputerName is not responding to a ping request. Please investigate urgently.”

#Send it
Send-MailMessage -to $recipient -from $sender -subject $msg_subject -body $msg_body_text -smtpserver $smtp_server


} while ($true)


Not very sophisticated, but it will tell you if something has switched off/ rebooted accidentally (you can probably add process monitoring in but this wasn’t my intention).


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s