PS Script Not Running As Scheduled Task
Follow this post to see why a scheduled task is not running successfully.
First off as a general rule of thumb, don’t run GUI applications as scheduled tasks. The main point of scheduled task is to run some code while you are away. That being said, the most common issue I hear is
I can't see the output from my script!. I then have to explain this is because scheduled tasks are often configured to be ran as
SYSTEMso you won’t see any output. This is why it is crucial to add logging to your scripts.
start infield is null. You may want to set it to
c:\Scripts\and see if it behaves differently. I usually get around this by skipping PS files altogether and call a batch file in the same directory which then calls the PS1 script.
Network resources don’t have the appropriate permissions. Remember that when running as
SYSTEM, you are running as the computer object that it is running. These often don’t have permissions to network resources so they fail silently. If the machine is domain joined, just ensure that
Authenticated Usersis set the appropriate permissions. See here and here.
Some applications are not available to the
SYSTEMaccount and install as user only. You can usually run a repair on the program and choose
To quote a reddit user:
- I have no idea why this is, but when working with other COM objects, I’ve found I’ve had to do this incredibly dumb thing.
- Create two folders:
- I saw this somewhere in a technet post and laughed it off, but it actually worked.
- I’ll reiterate, I have no idea why it worked.