I have a powershell script that I want to start when Windows 7 starts how can I do that?

  • Have to start before user login?
    – lg.
    Commented Feb 17, 2011 at 8:32
  • No, it can starts after a user login
    – xdevel2000
    Commented Feb 17, 2011 at 8:51

3 Answers 3


If you run this command at startup, you should be fine:

powershell.exe -noexit c:\scripts\MyAwesomeScript.ps1

More info on this subject can be found here: http://technet.microsoft.com/en-us/library/ee176949.aspx

  • I need to have a file that contain the code and auto-execute after login...like a .bat I presume...
    – xdevel2000
    Commented Feb 17, 2011 at 13:08
  • You could put this in a .bat and make it run that way, but I'm pretty sure you can drop this command in a Group Policy Scheduled Task. Commented Feb 17, 2011 at 18:04

Goto Start -> Run -> taskschd.msc. Create a basic task and set the trigger to "When the computer starts". Select "%windir%\System32\WindowsPowerShell\v1.0\powershell.exe" for your program name and set the full path to your powershell script as it's argument. Note that this will only run when a user logs in to the machine.

If instead you need this script to run without requiring a user to login, then goto Start -> Run -> Gpedit.msc. Under computer Configuration -> Windows Settings -> Scripts, double click on the "Start Up" icon to edit it's properties. Click on add and then the "Script Name" to be "%windir%\System32\WindowsPowerShell\v1.0\powershell.exe" and your script parameters to be the path to your powershell script. Hope this helps


Add a link to your powershell script into StartUp folder.

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp

You must log in to answer this question.

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