Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to restart a windows 2008 server only if the gatwaay is not responding. Is there a way to conditionally ping the gateway and if the gateway is not reachable a restart is triggered?

Thank you

share|improve this question
Restart the gateway, or the server? Or is the server the gateway? – Nixphoe May 13 '11 at 15:30
I was trying to figure out why you'd need to restart a server if the gateway was down. O_o – GregD May 13 '11 at 15:35
@Nixphoe - I need to restart the actual sever. Its happening that when the link is down , the firewall service crashes and the only way to recover is by restarting the whole server.I am really struggling with this one. thank you. – redknight May 13 '11 at 16:15
up vote 1 down vote accepted

It might be a better option to contact the firewall vendor to see what you can't do to get those services started with out a reboot (seriously though). But to do what you're asking, you could try running this batch script, have it start up with Task Scheduler on reboot. You could either loop it with the "goto start" option listed. Or remove that and just have Task Scheduler run it every 5 minutes.

ping [gatewayIP]
if %errorlevel%==1 shutdown /r 
goto start
share|improve this answer
thank you for the batch script. I understand that this is only a dirty workaround, but it avoids me having to check in at unholy hours ! As regards vendors I am checking since on the firewall I have a third party content filtering product and I am monitoring to see if this could be the culprit. – redknight May 13 '11 at 16:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.