Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Scheduled Task / Batch Code on Windows Server 2008 R2 SP1


25 Mar 2013   #1

Windows XP Professional 32bit
 
 
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 -
Code:
sc stop Foobar_f52d190a-0e84-4b3a-ab03-xsfc6450b845
timeout 10
sc stop Foobar_935feeac-b874-4cca-b8eb-xsf55881ffb2
start.bat -
Code:
sc start Foobar_f52d190a-0e84-4b3a-ab03-xsfc6450b845
timeout 10
sc start 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?

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...

My System SpecsSystem Spec
.

28 Mar 2013   #2

Windows XP Professional 32bit
 
 

Turns out that the code works... The reason that I kept receiving the 0x5 result is due to the Scheduled Tasks not being executed with "highest privileges". Once this was set, everything ran like a charm.
My System SpecsSystem Spec
Reply

 Scheduled Task / Batch Code on Windows Server 2008 R2 SP1




Thread Tools



Similar help and support threads for2: Scheduled Task / Batch Code on Windows Server 2008 R2 SP1
Thread Forum
How can I set a scheduled task to minimize open windows before sleep? General Discussion
Scheduled Task history indicates task completed successfully but.... Performance & Maintenance
Server 2008 Task to Send Mail Browsers & Mail
Setting up home network server using windows server 2008 R2 Network & Sharing
Error Code 80073712--Windows Server 2008 update Chillout Room
windows 7 scheduled task remote access Network & Sharing
Best Antivirus in server windows 2008 server 2008 r2 System Security

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 08:11 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33