I have a PowerShell script (that works). In Windows Task Scheduler I created a new task to execute \"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\">
There are several possible causes for a PowerShell script invoked by the task scheduler to complete with code 0x1:
Run with highest privileges flag (checkbox on the task's General tab) enabled.*-File ".\MyScript.ps1" -Parameter1 'Demo', instead try: -Command "& .\MyScript.ps1 -Parameter1 'Demo'"*As Ben points out in the comments, Run with highest privileges doesn't have to be enabled / it depends if the script requires admin rights (e.g. if some commands like Set-ExecutionPolicy or Stop-Process may require these). If you're not sure, try ticking the option to see if it fixes your issue; if it doesn't seem to make a difference, leave it unchecked.