0

I'm trying to run a PowerShell script that runs hourly. When I run the script outside Task Scheduller it goes right, but when I try to run using task scheduller, it shows me an (0x1) error.

Here is how my task is configured:

Task Configuration

  • Action: Start a Program
  • Program/Script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
  • Add Argument (Optional): powershell.exe -NoProfile -NoLogo -NonInteractive -ExecutionPolicy Bypass -File \\C:\xampp\java_monitor.ps1
  • Start in (Optional): Empty

Does anyone knows what should I change or add to fix execution?

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
  • What user are you using for the task? Has the user the necessary rights to run PowerShell scripts? – f6a4 Mar 15 '19 at 13:22
  • 1
    For one thing: remove `powershell.exe` from the argument list. Also remove the leading backslashes before the script path. For further troubleshooting see [here](https://stackoverflow.com/a/41635982/1630171). – Ansgar Wiechers Mar 15 '19 at 13:29
  • I'm using an user with administrative privileges to run it. – Guilherme borges Mar 15 '19 at 13:42
  • admin user is not enough. log on with this user one time and set PowerShell policy repectively. – f6a4 Mar 15 '19 at 14:59

0 Answers0