Search code examples
powershellwindows-server-2008windows-server-2008-r2windows-server

How do I grant SeBatchLogon privileges to a domain account on a Windows server with Powershell?


I am using Windows Server 2008 R2. For a server joined onto a Windows 2008 R2 domain I want to grant SeBatchLogon privileges to an account, for example, I want the domain account 'mydomain\batchuser' to have batch logon privileges on the local Windows 2008R2 server so that I can run scheduled tasks under that logon. I can set the privileges through the Windows GUI, but how can I script this with Powershell?


Solution

  • Use ntrights.exe from the Windows Server 2003 Resource Kit Tools:

    ntrights +r SeBatchLogon -u mydomain\batchuser