I'm trying to run a PowerShell command via Task Scheduler but keep getting the below result when the task tries to run PowerShell on my Windows Server 2008 R2 environment.
action "powershell.exe" with return code 1.
When I run the script in PowerShell manually, the script runs. But for some reason, when I call it from the Task Scheduler it doesn't run.
A screenshot of how my action is set up is attached below.
I've made sure to do the following:
- Set ExecutionPolicy to RemoteSigned
- Set task to run with highest priveleges
- Set task to run whether user logged on or not
- Set task configuration for Windows 7, Windows Server 2008 R2
I'm fresh out of ideas.
Copyright Notice:Content Author:「Harif87」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/51696465/issue-running-powershell-on-windows-task-scheduler