New
#1
Scheduled Task / Batch Code on Windows Server 2008 R2 SP1
I have some processes that I need to stop and restart each morning. In order to do this, I've created 2 scheduled tasks inside Task Scheduler:
1.) Stop Foobar (Both Environments) - Triggers @ 6:45 AM Every Day
2.) Start Foobar (Both Environments) - Triggers @ 6:48 AM Every Day
Both tasks above make use of a respective *.BAT file to shut down and restart a task agent service. Unfortunately, the tasks have been bombing with "(0x5)" each morning. I'm not sure why, but I suspect it has something to do with the following code associated with each *.BAT file:
stop.bat -
start.bat -Code:sc stop Foobar_f52d190a-0e84-4b3a-ab03-xsfc6450b845 timeout 10 sc stop Foobar_935feeac-b874-4cca-b8eb-xsf55881ffb2
From what I understand of 0x5 codes, it's a "universal access denied" indicator. Is this true? If so, that would imply then that the service account responsible for executing the batch files isn't being permitted execution rights, right? Odd, because I've provided my username / password for the tasks to execute whether the user is logged on or not. From what I can see, it's storing the password, too... So what gives?Code:sc start Foobar_f52d190a-0e84-4b3a-ab03-xsfc6450b845 timeout 10 sc start Foobar_935feeac-b874-4cca-b8eb-xsf55881ffb2
Any insight is appreciated. And I added the "timeout 10" in order to give the tasks some buffer between each task. Maybe it needs more? I dunno...