Why is your PowerShell Scheduled Task not running?
chustedde
Posted on March 14, 2019
This is one of the most-referenced entries I've made in my department's shared notes, so it seemed like a good choice for my first post to a wider audience!
Signature required
- Does your task server require scripts to be signed?
- If your script is signed, is the signature still valid? Here's how to check:
Get-AuthenticodeSignature -FilePath your-script.ps1
- If it's not valid, sign it again (I have a shortcut to do this in my PowerShell profile)
Who's running things?
- Is the task set to run whether or not the user is logged on?
- Do you have a specific account that runs scheduled tasks?
- Did you save the correct password when setting up the task?
- Just try the password one more time... I won't tell anyone you tried typing it instead of copying and pasting 😅
- Does the user/script-running account have the correct permissions to do everything you need it to?
- Folder permissions are a common issue
Trust issues
- Does the account running the script trust your signature?
- You may need to trust/re-trust your signature, especially if you were recently issued a new code signing cert
- If possible, on the machine running the task, open up a command prompt (or PowerShell!) and try launching PowerShell as the user running the task:
runas /user:example.edu\taskrunner powershell.exe
- Try running your script in the new PowerShell window that just popped up
- When it asks you to trust your script, you say
yes[A]lways
!
I hope this saves at least a few people from a few moments of frustration. There are weirder issues out there for sure, but this checklist should help you solve the most common ones!
💖 💪 🙅 🚩
chustedde
Posted on March 14, 2019
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.