Running jobs with Task Scheduler

If you plan to run a batch job in the name of a specific user, you probably need to give the rights for the user to do so. For this purpose we need to open the Local Security Policy editor:

Then search for this: Local Policies -> User Rights Assignment -> Log on as a batch job

Double click and add the user / group you wish.

Another important thing is if you work with Excel files in your script (Powershell) and if it is not working at all or not as expected: you have to check if these two folders exit:


C:\Windows\System32\config\systemprofile\Dektop


C:\Windows\SysWOW64\config\systemprofile\Desktop

No matter if they are empty or not, they must exist!!! (From here.)

If you want to run a Powershell script as a job, then you can call the script e. g. like this:

Start a program:

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe or just Powershell

Add arguments (optional):

-ExecutionPolicy Bypass -File “filename.ps1” Automatic

“Automatic” is a parameter I use in my scripts which can be run in both modes: manual / automatic. More info here.

You can run a single command too – for example the following task mounts a vhdx file as a drive at system startup:

Program: PowerShell

Add arguments (optional): Mount-DiskImage -ImagePath ‘C:\Temp\myDrive.vhdx’

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *