Hi, Damian Garbus here and Today I want to show you how to run Powershell script from Task Scheduler. In the post 3 simple examples of use Powershell for Everybody (for you too) I describe how I’m using Powershell on a daily basis. One example is about backup my KeePass file. I don’t run this backup manually. I’m run Powershell script in Task Scheduler . Please, finish this post completely because I have a surprise for you. OK, Let’s start.
1. Save you script from you want to run
The first step is to save the Powershell script. I recommend one place for all scripts because it will be easier to manage. Now you can copy the script path. You can use for its combination of shift+right mouse button and “Copy file path”.
2. Create Task
Launch Task Scheduler console
Create Folder for your tasks
Right click and choose “Create task…”. Enter the name and description of new Task.
It’s time to setup trigger and action
If you want learn more about available options please visit official Microsoft Docs Page.
3. Test running Powershell script
When you finished setting the task I always recommend to test it. Sometimes one spelling mistake can generate the problem.
Free Task Scheduler Script template
If you run Powershell scripts in Task Scheduler I recommend for you:
- Generate log file – I recommend using log to file function. When script have problem you can check log files to find what is wrong.
- It’s not best practices but I like use *.ini file to use like param file. The example scenario is when you want to change recipient email address for notification you don’t have to edit script or task parameters but only edit param file dedicated for it.
For faster write Powershell script for task scheduler I prepare template with
Thanks for visit my blog and see you later 🙂