Archive for category Scheduled Tasks

Run PowerShell Script in Schedule Tasks

The following will allow you to run a Powershell script as a scheduled task. These instructions have been tested on a Windows 7 64bit computer.

Before proceeding, make sure your Powershell script runs without any errors. The best way to make sure your script is running fine is by calling it from a command prompt.

Note: Make sure you run Set-ExecutionPolicy from an elevated Powershell window to make sure your system (Windows 7) is allowed to run Powershell scripts.

  1. Open a Command Prompt window
  2. Run: powershell -file <your ps script file>
  3. Make sure it executes properly

 

Now, open Windows 7 Task Scheduler:

  1. In the Actions tab
  2. Power shell is found at: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    1. You can also just use powershell.exe
  3. In Add arguments (optional) field, add the following: -File “C:\Path-to-your-script\Your-ps-script.ps1”
    1. Sample: -File “C:\Program Files (x86)\Info Folder\Get-Speed.ps1”
  4. In Start in (optional) field, add the following: C:\Program Files (x86)\Info Folder
    1. Sample: C:\Program Files (x86)\Info Folder

2016-09-19_1151

I’m not going to go over the other sections as this is the main section to be able to execute Powershell scripts from Schedule Tasks.

, , ,

Leave a comment