Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

How can I schedule a Powershell script to run every day at 3am in Windows 8?

share|improve this question
What have you tried so far? Did you attempt to use Task Scheduler? Use powershell /? to know how to run a PS1 script from the command-line. – Karan Dec 27 '12 at 22:30
I tried using Task Scheduler to run the script, but when I try to test it by running it from the Scheduler, its status changes to Running and never finishes. Note that I tested the script and it successfully runs and exits if you right click it run it with Powershell. – Wesley Tansey Dec 27 '12 at 22:36
You should have mentioned this in the original question, else as you can see below people will just waste their time teaching you how to create a scheduled task. Did you try setting the task to run as admin/with highest privileges? – Karan Dec 27 '12 at 22:45
Yes, I tried that as well. It is set to run with highest privileges. – Wesley Tansey Dec 27 '12 at 22:48
Why not set a trigger a few mins. from now and simply test? – Karan Dec 27 '12 at 23:37
up vote 2 down vote accepted

EDIT: This is a proof of concept that worked for me.

  1. open a new textfile and type in
    write-Host 'Hello World'
    $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

  2. save it as hello.ps1 on your desktop

  3. open the 32-bit version of powershell.exe with elevated rights
    (right click + open as administrator)

  4. make sure, that you didn't use the x64 version until you want to

  5. On my Windows 7 the "Windows PowerShell (x86)" startmenu shortcut points to the x64 version! These versions use seperate policy settings. It took me a while to figure that out :)

  6. Type in the following to allow powershell scripts and confirm it with Y
    Set-ExecutionPolicy Unrestricted

  7. That setting is stored permanently. Do a reboot just to check that.

  8. check the powershell policy and confirm that it is still unrestricted with

  9. open schedule task window

  10. make a scheduled task which points at the x86 version

  11. Type in the following for the optional parameter:

  12. Execute your task manually through a right-click in your schedule task window

  13. Wonder why it says "running"

  14. Hit F5 to refresh. You will notice that the "still running"-status disappears.

  15. Be happy (after 1 hour :p)

share|improve this answer
That does not work. Please see my comment in the original post. – Wesley Tansey Dec 27 '12 at 22:36
What was the exact syntax you used in your task scheduler? – nixda Dec 27 '12 at 23:08
I tried it the way you suggested in your edit. It still just changes the status to Running and never finishes. – Wesley Tansey Dec 27 '12 at 23:17
Please see my full edit. There has to be a normal way. – nixda Dec 28 '12 at 1:04
Regarding step 6, it should probably say "confirm it with Y" (instead of J). I realise it's J for you because your Windows display language is set to German, but SU normally assumes English localisation, unless specified otherwise. – Indrek Jan 2 '13 at 23:56

run 'taskschd.msc', navigate to Powershell and create the job/schedule.


share|improve this answer

It took me a while to get my Scheduled PowerShell task to work.

Here are a few tactics that helped me.

a) Get a simple PowerShell script working.
b) Understand all the various Task Manager tabs, including the conditions and actions (I think you have done this already)
c) Watch the path to the various files.

My killer problem was not realising PowerShell was the program and the script was merely an argument.

Another minor help was introducing -ExecutionPolicy Bypass before the file name thus:
-ExecutionPolicy Bypass -File "D:\PShell\Process Task.ps1"

Finally, I am never sure about the SuperUser etiquette, but this is my page on the subject of Scheduling PowerShell.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .