Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

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.

share|improve this answer

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.

share|improve this answer

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:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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