?
Solved

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

Posted on 2007-11-22
4
Medium Priority
?
221 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:Rick Hobbs
Rick Hobbs earned 600 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 1400 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:Rick Hobbs
ID: 20354856
Glad I could be of help. Thanks.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

So you have two Windows Servers and you have a directory/folder/files on one that you'd like to mirror to the other?  You don't really want to deal with DFS or a 3rd party solution like Doubletake. You can use Robocopy from the Windows Server 200…
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…
Loops Section Overview
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

809 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