211k views
4 votes
How to run a powershell script from task scheduler

1 Answer

6 votes

Final answer:

To run a PowerShell script from Task Scheduler, follow these steps: open Task Scheduler, click on Create Basic Task, give your task a name and description, select the trigger for when you want the script to run.

Step-by-step explanation:

To run a PowerShell script from Task Scheduler, you can follow these steps:

  1. Open Task Scheduler by searching for it in the Start Menu or by pressing Windows key + R and typing taskschd.msc. Press Enter.
  2. Click on Create Basic Task in the Actions pane on the right-hand side.
  3. Give your task a name and description, then click Next.
  4. Select the Trigger for when you want the script to run (e.g., daily, weekly, at log on, etc.), then click Next.
  5. Choose Start a program as the Action, then click Next.
  6. Browse and select the Powershell.exe executable (usually located in C:\Windows\System32\WindowsPowerShell\v1.0\).
  7. In the Add arguments field, specify the path to your PowerShell script (e.g., C:\path\to\script.ps1).
  8. Click Next and then Finish to create the task.

Now, your PowerShell script will run automatically according to the trigger you set in Task Scheduler.

User Richard Askew
by
9.5k points