How to grant “log on as a service” permission to a (local) from the command-line

command-line-interfacewindows-server-2008-r2windows-server-corewindows-service

On Windows Server 2008 R2 Core Edition, how do I assign the "log on as a service" permission to a user, from the command-line?

(ntrights.exe from the Win2003 resource kit is not included in Win2008 R2 Core).

I don't mind whether it's cmd or a powershell cmdlet. I would prefer it to be a command run locally on the box, rather than one invoked remotely.

The server is not, and will not be, part of an active directory.

Best Answer

I ended up grabbing ntrights.exe from the Windows 2003 Resource Kit and placing it on the server, then running ntrights +r SeServiceLogonRight -u <my user>.

I didn't install the resource-kit, because

  • I only needed ntrights.exe
  • Installation threw some OLE-related errors (that seemed to be irrelevant, but still)