Solved

Set all Windows Services to restart on first failure

Posted on 2009-05-02
3
1,965 Views
Last Modified: 2013-12-14
I would like to set all Windows Services to restart on first failure. The default action in the Recovery tab is suprisingly 'Take No Action'. Does anybody know the fastest way to make all Automatic services that need to run to have the 'Restart the Service' selected as the First Failure option? The idea is to have 99.9% uptime for all services on my servers.
0
Comment
Question by:drivencorp
3 Comments
 
LVL 9

Expert Comment

by:samiam41
ID: 24288288
Is this for your NT4 server?  If so, they best way to ensure 99.9% uptime is to migrate to Windows 2003 or 2008.  ; )  Aside from that, manually may be the way to do it if time is critical.  If this is a learning process or you want to use it again, hopefully someone will have a script for you.  You may want to clarify the OS though.  

Good luck mate.
0
 

Author Comment

by:drivencorp
ID: 24288375
Operating systems are both Windows 2003 and Windows 2008.
Appreciate your help.
0
 
LVL 82

Accepted Solution

by:
oBdA earned 500 total points
ID: 24298469
You can do this as a batch script with with sc.exe and a GPO *startup* (not logon!) script for the servers in question.
Note that
- you will not be able to change this for all services (Alerter, for example).
- in all likelihood, this won't change too much in terms of uptime/reliability. If a service fails, it usually fails for a reason, and that reason usually isn't fixed just by restarting the service.
That said, below's a syntax example for the Telnet server.
- You need the "real" service name, not the display name.
- Note the space after the "="!
- "reset= " defines the number of seconds after which the error counter is reset to 0; this *has* to be defined together with actions=
- "actions= " defines the actions to be taken after a failure, followed by the delay time in milliseconds separated by a "/"; just concatenate the first/second/third failure definitions (and for the third and following, I'd actually use "no action").
So this command will configure Telnet Server to reset the counter after 0 days (never), to restart after 60 seconds for the first failure, and to take no actions taken for the second or later failures.
sc failure "tlntsvr" reset= 0 actions= restart/60000////

Open in new window

0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

Several part series to implement Internet Explorer 11 Enterprise Mode
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

707 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now