Reputation: 16214
PowerShell 2.0 on Windows 7 64-bit
When I tested out in a shell, the following works fine:
powershell -command { sleep 5 }
But when I have this in a Scheduled Task, with powershell
in the Program box and -command { sleep 5 }
in the Argument box, Task Scheduler reports "The operation completed successfully. (0x0)" but nothing is run.
I had to record the screen with a video camera and then played back in slow motion to find out what is going on. After the PowerShell profile script runs, sleep 5
shows on the screen with no error and PowerShell closes immediately.
(Both my x86 and x64 versions have ExecutionPolicy set to RemoteSigned.)
What do I have to do to make -command
work in Task Scheduler?
.
Upvotes: 3
Views: 1993