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