SharePoint Views

How to set ‘Log on as batch job access’

If you are trying to run a PowerShell Script through Windows Task scheduler in a Windows server using a service account like me, at the end of task scheduler a warning message was shown that the service account need ‘Log on as batch job access’ to run the job.

Here is a blog which explains how to schedule PowerShell script to run from task scheduler

If you try to run the job without providing log on as a batch access to the account running the job, you will get an error with OpCode: Launch Failure – Task Scheduler failed to start the task xyz.

Here are the steps to set up Log on as a batch job access for an account or group through Local Security Policy. This access can also be granted through Domain Security Policy.
1. Go to Control Panel, select Administrative Tools Control Panel -> Administrative tools
2. Open ‘Local Security Policy

local security policy
3. Expand ‘Local Policies‘ under Security settings
4. Select ‘User Rights Assignment‘.

Log on as batch job
5. In the right pane, right click on ‘Log on as a batch job‘ and select Properties
6. Add user, click ‘Ok‘. Close Local Security Policy tab.