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.

link|improve this question

54% accept rate
feedback

2 Answers

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

ntright +r SeServiceLogonRight -u testUser

link|improve this answer
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 ;-) – c10k Consulting 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/… – c10k Consulting 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
feedback

Some interesting suggestions here

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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