Good morning everyone! I'm running into a problem with Task Scheduler when trying to execute a PowerShell script stored on a remote server. The script works perfectly when it's local and runs fine directly in the PowerShell application using the same account and file path that the scheduled task is configured with. I'm using the 'Start a Program' action with the path 'C:WindowsSystem32WindowsPowerShellv1.0powershell.exe' and the arguments '-ExecutionPolicy Unrestricted -File \192.168.1.69Script_FolderCheck_For_Restart.ps1'. I'd appreciate any insights on what might be going wrong!
4 Answers
You might want to check the logs to see if Task Scheduler is having trouble accessing that share. It could be that the system account or the user lacks the necessary permissions. Granting read access to either the machine or user might help resolve this issue.
You should also look out for whether your script tries to perform actions that require elevated privileges. If it does, ensure you have 'Run with highest privileges' checked. That could solve a lot of authentication issues you're facing.
If the task is stuck running, it might be stuck on an authentication prompt. Check your script for any network resource access or elevated commands. In Task Scheduler, make sure to enable 'Run with highest privileges' and select the correct account for the script execution. Also, consider using PowerShell's transcript feature for logging to see where it might be failing.
It sounds like there might be an issue with permissions. Make sure that the account running the task can access that remote path. If you’re using a service account, check whether it has the needed permissions without requiring a user to be logged in. Task Scheduler often needs proper access to remote locations, or it may run into permission issues.
Thanks for your input! I did try running it with 'Run as different user' in PowerShell, and it worked fine. Yes, I'm using a service account with a saved password, which should theoretically cover the permissions.