If you want to schedule a PowerShell script and run it as a scheduled task, you can do that very easily by following the below steps with screenshots.
- Step 1: Press the Windows button on your Windows 10/11/Server and open Windows Administrative Tools (you can also get it there by going to Control Panel -> System and Security -> Administrative Tools)
- Step 2: Now open Task Scheduler
- Step 3: Under Actions select Create Basic Task...
- Step 4: Now in the Wizard provide details.
Name: My Daily PowerShell Script Description: A task scheduler to run PowerShell script to run every day at midnight.
- Step 5: Say we want to trigger the Script Daily.
- Step 6: Next, let's add the Start date and time details, have selected to recur every 1 day.
- Step 7: For the Action - we want to start a Program which is PowerShell.
- Step 8: Now, fill in the details,
Program/Script: It should be the path to PowerShell.exe Example: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Add Arguments: We add the Path to our PowerShell .ps1 script C:\Users\Administrator\Desktop\powershell-script.ps1 Start In: Where the Script is located again. C:\Users\Administrator\Desktop\ - Step 9: Verify all the details, and check "Open the Properties dialog for this task when I click Finish" and hit Finish.
- Step 10: You will next see the Properties of the task you just created, note a few things that you can change here is,
- Can change the script to run whenever user is logged in or not
- Enable: Run with highest privileges.
- Configure the Server for.
- Can even make the script hidden.
- Step 11: That it! We have configured a PowerShell script to run from Task Scheduler!
Note: Once you make changes you will be asked for the Admin password.
Under the "Task Scheduler, you can Run the PowerShell Script on demand, and even disable, export, or even delete it.
Facing issues? Have Questions? Post them here! I am happy to answer!
Author Info:
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
More Posts related to Powershell,
- How to upgrade PowerShell on Mac
- How to install AWS CLI 2 on Windows 11 using PowerShell
- How to switch to Powershell on Mac Terminal
- How to connect to Microsoft Exchange Online using PowerShell
- How to Check PowerShell Version? [Windows/Mac/Linux]
- How to Comment out Code in PowerShell Script
- How to Identify installed PowerShell version
- How to install PowerShell on macOS
- Open PowerShell Terminal in Visual Studio Code (VSCode)
- PowerShell ps1 script is not digitally signed, you cannot run this script on the current system
- Update Powershell Using Command Line
- PowerShell 1..10 foreach Example
- PowerShell Fix: Get-Help cannot find the Help files for this cmdlet on this computer
- List of PowerShell Cmdlet Commands for Mac
- Help or Man equivalent in PowerShell
- PowerShell SubString with Examples
- PowerShell: How to Get Folder Size
- PowerShell Traditional For Loop Example
- PowerShell Switch Statement with Examples
- PowerShell Concatenate String Examples
- PowerShell For Each Loop Examples
- PowerShell: Grep Command Alternative - Select-String
- How to delete a file using PowerShell [Windows/macOS]
- Fix: nano is not recognized as an internal or external command - Windows PowerShell
- PowerShell on Mac: The term get-service is not recognized as a name of a cmdlet, function, script file, or executable program
More Posts:
- YAML Parser using Java Jackson Library Example - Java
- How to Change Android Toast Position? - Android
- How to install Google Chrome using Mac Terminal - Google
- Python: pandas merge DataFrames on Common Column - Python
- PowerShell: Grep Command Alternative - Select-String - Powershell
- Python: Access index/counter of a for loop iteration - Python
- 47: Take a list of strings and print each string. [1000+ Python Programs] - Python-Programs
- Changed AD user display name showing old name in SharePoint - SharePoint