Scheduled task will not run as scheduled!

A

alex.birchall

Hi,

The situation is this:

I am trying to make use of the psshutdown.exe tool available from
Sysinternals (http://technet.microsoft.com/en-us/sysinternals/
bb897541.aspx) to reboot a Windows 2000 Professional server.

I have a batch file containing the following:

@echo off
c:
cd\
cd pstools
psshutdown -f -r

goto EOF

:EOF
exit

This batch file is saved in the root of C:

I can run this batch file manually (i.e., double-click on it and it
works - the computer restarts).

I set up a scheduled task to run this batch file at a specified time
in the future.

If I choose to run the scheduled task now, I can and it works.

But if I leave the scheduled task set up and lock the computer, the
scheduled task will not run. The Last Result appears to indicate it
ran successfully (0x0), but it demonstrably has not.

I have exactly the same scheduled task set up on a different Windows
2000 server and it works.

I'm stumped! Can anyone explain this mystery?

Many thanks in anticipation.

Alex Birchall
 
P

Pegasus [MVP]

Hi,

The situation is this:

I am trying to make use of the psshutdown.exe tool available from
Sysinternals (http://technet.microsoft.com/en-us/sysinternals/
bb897541.aspx) to reboot a Windows 2000 Professional server.

I have a batch file containing the following:

@echo off
c:
cd\
cd pstools
psshutdown -f -r

goto EOF

:EOF
exit

This batch file is saved in the root of C:

I can run this batch file manually (i.e., double-click on it and it
works - the computer restarts).

I set up a scheduled task to run this batch file at a specified time
in the future.

If I choose to run the scheduled task now, I can and it works.

But if I leave the scheduled task set up and lock the computer, the
scheduled task will not run. The Last Result appears to indicate it
ran successfully (0x0), but it demonstrably has not.

I have exactly the same scheduled task set up on a different Windows
2000 server and it works.

I'm stumped! Can anyone explain this mystery?

Many thanks in anticipation.

Alex Birchall

Throw out some of the superfluous stuff from your batch file, then run this
version instead:

@echo off
echo %date% %time% %UserName% >> c:\test.txt
c:\PSTools\psshutdown -f -r 1>>c:\test.txt 2>>&1

Now allow the job to be run under the Task Scheduler, then examine the file
c:\test.txt. You will most likely find that the job *did* run, even though
you're convinced that it did not. You will probably also find the reason why
it did not shut down the machine as expected.

Remember that scheduled tasks must be run under an account that has a
non-blank password.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top