I am trying to create a script that will create a scheduled job that will stop a windows service. I know that I can use schtasks, but am having difficulties when the executable requires parameters. I have been trying to use NET STOP in order to stop the service. I know that I could alternatelyuse SC.exe STOP, but both require the service name as a parameter and in many cases the service name contains spaces.
How can I make this work?
Set objShell= WScript.CreateObject("WScript.Shell")
strTask = "schtasks /create /tn ""Stop_WWW" /tr ""net stop ""World Wide Web Publishing"""" /sc minute /mo 5 /ru System"