Does anyone know the correct way to assign a Powershell script as a scheduled task?

I have the below syntax (where X:/ is another drive mapped as a share).

enter image description here


I always just put 'powershell.exe' in the 'Program/script:' textbox and the full path to the script in 'Add arguments (optional)'. That always works for me.

I would also use a UNC name instead of a mapped drive letter. Who know whether the user who runs the task knows about that drive letter.


I've had problems when running Powershell scripts using the Nagios windows client, NSClient++. The solution for me was to run the command as follows...

cmd /c echo "X:\Technet Scripts\updateWindows.ps1" | powershell.exe -Command -

I'm not saying this is the best or correct way for you to run your script from a scheduled task, but it may get it working for you.


What you have seems to be correct. Is it not running at the scheduled time, or are you getting an error?

The "-file" parameter isn't really required since you're not running the script in an existing session, but it should still work fine.

You can read more about running powershell scripts here: http://technet.microsoft.com/en-us/library/ee176949.aspx#EBAA

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.