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
caseyburk

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
caseyburk

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
Thread Forum
setting up a server for school help (windows server 2008)
As my final project for the year i am setting up a server that we will eventually move all our computers on to. I am using a poweredge 2900 as a server with windows server 2008 installed. As of now i have 2 computers connected to the domain which they can log on to. - what i need help with -...
Network & Sharing
Scheduled Task history indicates task completed successfully but....
Hi, New here. I'm using a Scheduled Task to fire a very simple bat file that pulls, compresses and pushes a set of files to a different network directory. The bat file runs fine manually. On a networked desktop I have set up the task to run at about 5am est (waking the machine), as highest...
Performance & Maintenance
Error Code 80073712--Windows Server 2008 update
Windows Server 2008 update error- code 80073712 Please someone help with this error
Chillout Room
windows 7 scheduled task remote access
I recently upgraded my system to Windows 7 and I am unable to access scheduled taks on my remote servers. Before when I was running off win XP i had no problem with this. But now, even when opening up share folders on all my servers, i dont see the scheduled task folder; however, when i check on a...
Network & Sharing
Windows 2008 Server or Linux for server
Hi all Have been a LONG LONG user of Linux as a server (hosting VM's XP / W7 mix) and file / print sharing. I used to avoid MS like the plague as far as SERVER environments are concerned - probably because my first experince was Windows NT (Windows NeanderThal or Windows No Thanks) which was...
Network & Sharing
Windows home server vs Server 2008 R2
I'm trying to decide between Windows Home Server and Windows Server 2008 R2 for my home server PC. Ordinarily it would be a clear cut choice, but I've got a free copy of Server 2008 R2 through my academic MSDN subscription. I'd like to avoid spending extra money if Server 2008 R2 would do the job....
Software

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 12:01.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App