I am looking to make a user from the command line with minimal rights to run a service. cmd.exe or powershell.exe are both options, but cmd.exe is preferable. So far I got this:

net user /add testUser227e5910-d1ac-11df-bd3b-0800200c9a66
net localgroup Users testUser /delete

The next step is to grant this user the right of "Log On As a Service". I can't seem to figure out how to do this. This is for a blog article, so I want a solution that applies to Windows XP, 2003, 2008, 2008R2, Vista and Windows 7.

  • Maybe possible using those commands in remote computer ? – Kiquenet Oct 16 '14 at 21:22

You need to install ntrights from the Windows resource kit : http://support.microsoft.com/kb/315276

ntright +r SeServiceLogonRight -u testUser

  • 1
    I'd prefer something that was built in, but if no one provides a better answer I'll mark that right. – Justin Dearing Oct 7 '10 at 13:33
  • There is nothing built in - if there was Microsoft wouldn't provide this in the resource kit ;-) – Geraint Jones Oct 7 '10 at 21:47
  • 1
    Ok I can't install that on windows 2008 or Windows 7. What do I do there? – Justin Dearing Oct 9 '10 at 2:58
  • You can use the 2003 version : serverfault.com/questions/141168/… – Geraint Jones Oct 9 '10 at 3:15
  • 1
    I'm about to write my own command line utility to do this. Either that or I'll just implement this feature request in mongod, the program that lead me down this rabbit hole. jira.mongodb.org/browse/SERVER-1227 – Justin Dearing Oct 9 '10 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.