Powershell script in Task Scheduler – 3 steps to run

Hi, Damian Garbus here and Today I want to show you how to run Powershell script from Task Scheduler. In 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 the Powershell script in Task Scheduler. Please, finish this post completely because I have a surprise for you. OK, Let’s start.

3 Steps…

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”.

Powershell script repository

2. Create Task

Launch Task Scheduler console

start task scheduler

Create Folder for your tasks

configure task

Right click and choose “Create task…”. Enter the name and description of new Task.

powershell script in task scheduler

It’s time to setup trigger and action

powershell script in task scheduler

powershell script in task scheduler

If you want to learn more about available options please visit the 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.

powershell script in task scheduler

Free Task Scheduler Script template

If you run Powershell scripts in Task Scheduler I recommend for you:

  • Generate log file – I recommend using the log to file function. When the script has problem you can check log files to find what is wrong. 
  • It’s not best practices but I like to use *.ini file to use like param file. The example scenario is when you want to change the 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 build-in functions to generate log file and read all parameters from ini file. You can download Task Scheduler Powershell Script Template here.

Thanks for visiting my blog and see you later 🙂

Get Access to Poshland Resources for FREE!!!

Signup now and receive an email once I publish new content.

I agree to have my personal information transfered to MailerLite ( more information )

I will never give away, trade or sell your email address. You can unsubscribe at any time.