Thursday, 16 August 2012

Scheduled Auto Troubleshooting


Pain
I have a computer (a PC, running Windows 7) standing on a network that is slightly unstable. One if the issues is that the computer's given IP address gets invalid. The fix is to renew the IP, by for example choosing to "Troubleshoot problems".

Troubleshoot problems to fix invalid IP address.

That is no major issue as long as the computer is within physical reach. However I want the computer accessible using a remote control software (personally I'm using TeamViewer for this purpose). If the computer's IP gets invalid it will not be accessible, as it will go offline.



Remedy
Based on the article "auto troubleshoot and fix internet and network problems in windows 7" I did what is described below. The solution is to set up scheduled automatic troubleshooting of the network. This way I have the computer troubleshooting the network once every day. If the computer goes offline due to invalid IP I can just wait for it to get a new IP address automatically. Below is how this was done.

Step 1 : Create a batch (.bat) file
I created a batch file named troubleshootNetworkProblems.bat in the folder C:\Users\frokle\miscellaneous\scripts.

The .bat script.

The only content of this file is the following magical line, that in mysterious ways will execute troubleshooting of the network if executed:
C:\Windows\system32\Rundll32.exe ndfapi,NdfRunDllDiagnoseIncident

One line wonder.

Step 2 : Create a scheduled task
The next step was to start the Task Scheduler and create a task that executes the batch file at given intervals.

Using the wizard to create a basic task.

Start daily...

... at 9 am.

We want to start a program.

Browse to the .bat script.

Finish basic setup, then do some tweaking as described below.

Pick your newly created task and chose properties.

Looks good the way it is here.

Click the "Conditions" tab.

In case the computer has gone to sleep, wake it up.

Go the the "Settings" tab.

If time slot is missed we do want to run the task as soon as possible.

Restart up to three times ever 10 minutes if task fails.

The task should not take long to run, stop it if it hangs.

Step 3 : Minor tweaking
Next was to do some tweaking to TeamViewer's settings.

Make sure TeamViewer starts with Windows in case of reboot.


And finally I changed auto update settings as well.

Made sure new updates were not installed automatically, to prevent the PC from booting.

Example of the troubleshooting running automatically:


No comments:

Post a Comment

Allowed HTML tags:
<b>bold</b>
<strong>strong</strong>
<i>italics</i>
<em>emphasis</em>
<a href="">hyperlink</a>


Please, show the courtesy of identifying yourself when adding a comment. Anonymous comments will, most likely, be removed.