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!
More Posts related to Powershell,- PowerShell: How to Check if a Module is Already Installed
- PowerShell: How to Write Output to a File
- PowerShell: Steps to Connect to connect to Exchange Online
- PowerShell Fix: Get-Help cannot find the Help files for this cmdlet on this computer
- PowerShell Traditional For Loop Example
- How to Run PowerShell Script as Administrator (Elevate)
- Update Powershell Using Command Line
- How to delete a file using PowerShell [Windows/macOS]
- PowerShell: Grep Command Alternative - Select-String
- PowerShell Concatenate String Examples
- How to add Sleep to PowerShell Script
- Connect Azure AD (Active Directory) for PowerShell
- How to Open PowerShell on Mac?
- List of PowerShell Function Commands for Mac
- How to Connect to Azure AD Account using PowerShell on Mac
- Download Google Chrome setup exe file using PowerShell
- Set Environment Variable in PowerShell for Mac
- How to switch to Powershell on Mac Terminal
- How to add sleep in Powershell Script
- PowerShell on Mac: The term get-service is not recognized as a name of a cmdlet, function, script file, or executable program
- How to Identify installed PowerShell version
- How to check PowerShell version
- How to install PowerShell on Mac using Brew
- PowerShell Switch Statement with Examples
- PowerShell ISE Alternative for Mac
More Posts:- [Fix] Steam Friends Network Unreachable Error - HowTos
- How to Add Tab in Python - Python
- How to un-hide tab bar in notepad++ - NotepadPlusPlus
- Docker Desktop needs privileged access macOS - MacOS
- Python print() function without a newline using the end parameter - Python
- RabbitMQ Java Spring Boot Application Properties List - Java
- How to stop or quit cat command? - HowTos
- [fix] Docker Desktop App not starting on Mac (macOS) - Docker