I want to script an install where a service needs to be run as a user. I want to be able to specify the user.
Creating the user is easy through the NET USER /ADD
command.
Specifying the user for the service can also be done: the SC CONFIG
command allows this.
Now the missing link: granting the user the "Log on as a service" privilege as a logon right (SeServiceLogonRight
). Is there a command for this? Or a simple script for PowerShell?
Answer
The easiest way to do this from a command line is definitely using NTRights.exe
from the Windows Server 2003 Resource Toolkit.
ntrights +r SeServiceLogonRight -u jeroen -m \\%COMPUTERNAME%
No comments:
Post a Comment