enjay Posted September 23, 2009 Posted September 23, 2009 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!
mac_shinobi Posted September 23, 2009 Posted September 23, 2009 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
sted Posted September 23, 2009 Posted September 23, 2009 batch file where spooler is whatever service you want net stop spooler && net start spooler save that and stick it in task scheduler 1
enjay Posted September 23, 2009 Author Posted September 23, 2009 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?
mac_shinobi Posted September 23, 2009 Posted September 23, 2009 (edited) 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 Edited September 23, 2009 by mac_shinobi 1
enjay Posted September 23, 2009 Author Posted September 23, 2009 Thanks you two, that works a treat. Now I just need to wait for Capita to work out why I need to do this!
pete Posted September 23, 2009 Posted September 23, 2009 If you need more flexibility or querying of services, there's also the "sc" command.
sted Posted September 23, 2009 Posted September 23, 2009 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now