Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

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

ntright +r SeServiceLogonRight -u testUser

share|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 ;-) –  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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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