Windows Server 2000/2003 Thread, Script to Restart Service in Technical; We have a server service which is rather temperamental, and periodically takes its ball home until you restart it. I ...
-
23rd September 2009, 02:00 PM #1 Script to Restart Service
We have a server service which is rather temperamental, and periodically takes its ball home until you restart it. I know how to use scripts/scheduled tasks to stop and start a service, but was wondering if it was possible to schedule a restart, or configure a pause into a command. Noob question, I know, but there you have it!
-
-
IDG Tech News
-
23rd September 2009, 02:02 PM #2 You can on the service properties set it to restart should it fail etc so that may be worth a shot short of that you could use wmi to stop and restart the service
WMI and VBScript - Stop and Start Services with Win32_Service
-
-
23rd September 2009, 02:10 PM #3 batch file where spooler is whatever service you want
net stop spooler && net start spooler
save that and stick it in task scheduler
-
Thanks to sted from:
enjay (23rd September 2009)
-
23rd September 2009, 02:16 PM #4 Thanks Sted, that looks perfect. What if my service name has spaces in it - do I need quote marks, or just write it out normally?
-
-
23rd September 2009, 02:19 PM #5 net stop "Service Name"
net start "Service Name"
Yes just put quotes around the service name and you can also use two ampersand symbols to make it do both commands one after the other
Last edited by mac_shinobi; 23rd September 2009 at 02:29 PM.
-
Thanks to mac_shinobi from:
enjay (23rd September 2009)
-
23rd September 2009, 03:07 PM #6 Thanks you two, that works a treat.
Now I just need to wait for Capita to work out why I need to do this!
-
-
23rd September 2009, 03:52 PM #7 If you need more flexibility or querying of services, there's also the "sc" command.
-
-
23rd September 2009, 07:27 PM #8 
Originally Posted by
NickJones
Thanks you two, that works a treat.
Now I just need to wait for Capita to work out why I need to do this!
they expect users to do their testing as its cheaper is my guess
-
SHARE:
Similar Threads
-
By CHR1S in forum Windows
Replies: 26
Last Post: 15th December 2011, 05:05 PM
-
By spaterso in forum Windows
Replies: 3
Last Post: 30th July 2009, 08:27 PM
-
By Gibson335 in forum Hardware
Replies: 8
Last Post: 23rd January 2009, 10:40 AM
-
By FN-GM in forum Scripts
Replies: 4
Last Post: 8th October 2008, 09:18 PM
-
By djones in forum Scripts
Replies: 4
Last Post: 18th May 2008, 10:26 PM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules