Solved

Auto toggle a service on Windows 2003 Server R2 using a scheduled event or other means.

Posted on 2007-11-22
4
212 Views
Last Modified: 2010-05-18
I have a mail service running on my Win2003 server which hangs once in a while. I need to shut down the service and turn it back on twice a day.  Is there any way to do this using a scheduled event or some other way? I don't see how a scheduled event can do this.  The mails services need to be toggled off then on very quickly, in a matter of a few seconds to avoid loosing mail connectivity.
0
Comment
Question by:Janrow
  • 2
4 Comments
 
LVL 22

Assisted Solution

by:rickhobbs
rickhobbs earned 150 total points
ID: 20337254
You can use the at command or the scheduler.
AT command:
http://support.microsoft.com/kb/313565
create two cmd files, one to start the service, one to stop the service.  Remember:  if the service name has spaces in it enclose it in quotes.
There is also an inexpensive progran called firedaemon (www.firedaemon.com) that has a lot more feature than scheduler or the at command and can do exactly what you want.
0
 
LVL 2

Accepted Solution

by:
pinkisthenewblue earned 350 total points
ID: 20337462
Rather that doing two scheduled tasks just do it in one. And if you struggle with the AT command (I always do) just open scheduled tasks in my computer. A script (.bat) to stop and start:

net stop "my service name"
net start "my service name"

Just add the script to a scheduled task. Shouldn't take more than 10 seconds to execute (at the very most).

NB if the net commands don't like the service name, open the mmc service snap in. Double click on the service, look at the 'Service Name' tab. Try this instead, i.e "net stop SharedAccess" would be the Internet connnection sharing service.
0
 

Author Comment

by:Janrow
ID: 20352292
Excellent. That did it. Thanks to you both.  Pnkisthenewblue gets the majority of the points for the example and the more slimlined solution.

0
 
LVL 22

Expert Comment

by:rickhobbs
ID: 20354856
Glad I could be of help. Thanks.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I've always wanted to allow a user to have a printer no matter where they login. The steps below will show you how to achieve just that. In this Article I'll show how to deploy printers automatically with group policy and then using security fil…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

760 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

20 Experts available now in Live!

Get 1:1 Help Now