1

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.

  • 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. – Ben May 9 '11 at 18:33
1

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

0

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

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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