Quantcast
Channel: Windows Server 2012 – The Wiert Corner – irregular stream of stuff
Viewing all articles
Browse latest Browse all 53

ntrights – grant/revoke Logon As Batch Job rights

$
0
0

Sometimes you want to run a batch file from a Task Scheduler task. For that, the user under which the task runs needs to Logon as a batch job right. If it hasn’t, you get this nice error message:

“This task requires that the user account specified has log on as batch job rights”.

Despite being part of the Windows Server 2003 Resource Kit Tools, you can still use ntrights in more modern Windows versions to grant or revoke this right.

As ntrights uses a hard to remember SeBatchLogonRight name for it and I tend to forget the ntrights syntax, I wrote two batch files to grant or revoke the Logon as Batch Job rights for the specified user:

Later I found out you can also do the same from C# or PowerShell, see: Set Logon as batch job rights to User by Powershell, C# and CMD.

Note that for domain users, not only the local policies apply, but also the domain policies might apply. So often it is easier to great a local user with virtually no rights (heck, not even in a group) as a bootstrap. See Scheduling a task in Windows Server 2008 R2 – Stack Overflow for more details.

–jeroen

via:


Filed under: Batch-Files, Development, Power User, Scripting, Software Development, Windows, Windows 7, Windows 8, Windows 8.1, Windows 9, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Vista

Viewing all articles
Browse latest Browse all 53

Trending Articles