I'm able to execute a powershell and script from the cmd prompt:
powershell.exe -noexit -file c:\utils\myscript.ps1
myscript.ps1 is a simple copy to a network drive:
copy -R c:\temp z:\tempbackup
Works fine from cmd... all the files are copied over.
But, when I try to make this a scheduled task in the Task Scheduler it just starts running an never completes. In the Task Scheduler I created a new task with this action:
Start a program
powershell -noexit -file c:\utils\myscript.ps1
I.e. the exact same command as from the cmd.
How can I get this to run?