[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Need a "Dead or Alive" program

Posted on 2016-10-05
4
Medium Priority
?
101 Views
Last Modified: 2016-10-05
I am trying to diagnose a problem with either my ISP or my router. In order to make that easier I need a utility that will run continuously and monitor if I have an internet connection or not. I would want it to be able to poll the internet in as little as every 15 seconds. Does anyone know of such a utility that exists?
0
Comment
Question by:Need-a-Clue
  • 2
  • 2
4 Comments
 
LVL 84

Expert Comment

by:David Johnson, CD, MVP
ID: 41830986
powershell script
function Test-Aliveordead {
Add-Type -AssemblyName PresentationCore,PresentationFramework
$continue = $true
do{
if(test-connection google.com -ErrorAction SilentlyContinue)
	{
	start-sleep -Seconds (15*60)
	}
else {
$ButtonType = [System.Windows.MessageBoxButton]::YesNo
$ButtonType = [System.Windows.MessageBoxButton]::YesNo	
$MessageboxTitle = 'Test pop-up message title'
$Messageboxbody = 'Are you sure you want to stop this script execution?'
$MessageIcon = [System.Windows.MessageBoxImage]::Warning
$result = [System.Windows.MessageBox]::Show($Messageboxbody,$MessageboxTitle,$ButtonType,$messageicon)
if ($result -eq "No") { $continue = $true }
else {$continue = $false} 
}
}
while ( $continue -eq $true)
}

Open in new window

0
 

Author Comment

by:Need-a-Clue
ID: 41831095
Hello David Johnson, CD, MVP,

I DO appreciate your post. However, I have zero idea what powershell is and the code you supplied is greek to me. I am seeking a program that I can easily run and configure. Maybe you might have an idea more along those lines?
0
 
LVL 84

Accepted Solution

by:
David Johnson, CD, MVP earned 2000 total points
ID: 41831136
DO appreciate your post. However, I have zero idea what powershell is and the code you supplied is greek to me. I am seeking a program that I can easily run and configure. Maybe you might have an idea more along those lines?

As an IT Pro I'd suggest you start learning PowerShell as it is the tool of preference for Windows and is also available for Linux. Powershell is replacing VBS (VBScript has not had any development done on it for over 10 years.

copy and save the code I gave you as a *.ps1 file. Start Powershell ISE or simply Powershell as an administrator and run the following 2 commands.

set-executionpolicy -executionpolicy remotesigned
update-help

To explain the script
function Test-Aliveordead {
Add-Type -AssemblyName PresentationCore,PresentationFramework
$continue = $true
do{
if(test-connection google.com -ErrorAction SilentlyContinue)
	{
	start-sleep -Seconds (15*60)
	}
else {

Open in new window

What this does is ping google.com and if it gets a result it will sleep 15 minutes and then try again
$ButtonType = [System.Windows.MessageBoxButton]::YesNo
$ButtonType = [System.Windows.MessageBoxButton]::YesNo	
$MessageboxTitle = 'Ping Failed'
$Messageboxbody = 'Are you sure you want to stop this script execution?'
$MessageIcon = [System.Windows.MessageBoxImage]::Warning
$result = [System.Windows.MessageBox]::Show($Messageboxbody,$MessageboxTitle,$ButtonType,$messageicon)
if ($result -eq "No") { $continue = $true }
else {$continue = $false} 
}
}
while ( $continue -eq $true)
}

Open in new window

if the ping failed then a message box will pop up asking you if you want to continue..
0
 

Author Comment

by:Need-a-Clue
ID: 41831154
Thanks, I will give your suggestion a try tomorrow. Thanks so much for custom writing the code for me.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface There are many applications where some computing systems need have their system clocks running synchronized within a small margin and eventually need to be in sync with the global time. There are different solutions for this, i.e. the W3…
Configuring network clients can be a chore, especially if there are a large number of them or a lot of itinerant users.  DHCP dynamically manages this process, much to the relief of users and administrators alike!
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month19 days, 6 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question