0

I started by creating a new basic task in task scheduler: program/scripts: powershell.exe

The file path was put in “add arguments”: -noprofile -executionpolicy bypass D:\DATA-MEDION\soft_ontwikkeling\powershell\zendRecentPGP16.ps1 . Before doing this I opened a powershell window as admin and have put the executionPolicy to unrestricted.

I still get the “cannot be loaded ...” security error when running the scheduled task. (Ultrashort powershell window opening and closing).

I ran the same script in a powerscript command box and in powershell ISE and it was OK. Any idea's?

techguy1029
  • 743
  • 10
  • 29
patpin
  • 11
  • 1
  • 4
  • Have you made sure that the `Run only when user is logged on` option is off? And is the `Run with highest priveleges` is checked? – techguy1029 Jun 20 '19 at 21:47
  • Thanks TechGuy. I did this and the task history is confirming now that it ran but, although not 'hidden', I did not see the blue powershell window anymore and the tasks scripted in the powershell ps1 are not executed. As said, they are executed when I run the ame ps1 in command box and in ISE. – patpin Jun 27 '19 at 07:34
  • This question might be of use: https://stackoverflow.com/questions/18259951/powershell-script-does-not-run-via-scheduled-tasks and this one too: https://stackoverflow.com/questions/12513264/batch-runs-manually-but-not-in-scheduled-task – techguy1029 Jun 27 '19 at 15:45

0 Answers0