Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a scheduled task that is running as USER. I have checked the box "Run with highest privileges" in the scheduled task properties. The task is a powershell script that, among other things, reboots the system. The script executes and runs normally, but as a scheduled task, it fails to reboot the system.

Here is the kicker: When I manually run the script as USER using the exact same command line as what's in the scheduled task, the script still runs but this time it actually reboots the system.

I have UAC disabled and USER is a member of the local Admins group. The local Admins group has the right to shut down the system. Nothing in the event logs offers any clues.

Why would the same script running under the same credentials work interactively but not as a scheduled task?

UPDATE: This is too weird. When the task ran on schedule, everything worked normally.

share|improve this question
    
What does Task scheduler report in the Last Run Result column when you run it manually from within the scheduler? –  uSlackr May 9 '11 at 17:56
    
Event log reading? Is there anything else happening at that time? –  Nixphoe May 9 '11 at 18:24
    
The operation completed successfully (0x0). The rest of the script works (pop-ups, etc.) but it just doesn't reboot the system. –  j.rightly May 9 '11 at 18:33

2 Answers 2

If you're running this as a power shell command you'll want to include the -Force option.

share|improve this answer

Verify any commands which reference path are absolute, IE. no calls to ./script.ps1, only C:\scripts\script.ps1

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.