Hi Mark Bovenzi,
Please add the full path of the script to "Add Arguments" and see if the script runs.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello
I am trying to run a Windows Task Scheduler...task to take a file and replace a SQL database nightly.
When I run the PowerShell script on it's own, it works flawlessly. Once I incorporate Windows Task Scheduler, it continuously fails. Either it'll run for a quick second and then go back to a Ready status with no errors in the History. Or it'll start, and sit at Run for over two hours and not do anything.
I have it to set to run with highest privileges, this is a Windows Server 2019, that is what the Configure it set for.
Program/script: powershell.exe
Add Arguments: Blank
Start In: C\Temp\Folder\Folder where .ps1 file exists
Keep in mind, if I run the script by itself, not in Task Scheduler, it works. I've tried adding the script path in Add Arguments, moved the script around, I am also logged in as Admin.
Stumped on this one. Thank you!
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question. To protect privacy, user profiles for migrated questions are anonymized.
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
You will probably need to append the -ExecutionPolicy Bypass argument. You could also have such parameters stored in a batch file calling powershelll. Whether you use powershell or a batch file, you can always output the execution to a text file to see what is going on (>> or Out-File).
I added the -ExecutionPolicy Bypass before the argument, same results. I tried -File, still the same.
Unfortunately, I am not quite sure what you mean about execution output into a text file, apologies.