Looking to add the "Log On as a service" right to an account via the command line

9,079

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

ntright +r SeServiceLogonRight -u testUser

Share:
9,079

Related videos on Youtube

Justin Dearing
Author by

Justin Dearing

.NET PHP and T-SQL Developer Accidental DBA Zend Certified Engineer, PHP5

Updated on September 17, 2022

Comments

  • Justin Dearing
    Justin Dearing almost 2 years

    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.

    • Admin
      Admin over 9 years
      Maybe possible using those commands in remote computer ?
  • Justin Dearing
    Justin Dearing over 13 years
    I'd prefer something that was built in, but if no one provides a better answer I'll mark that right.
  • Justin Dearing
    Justin Dearing over 13 years
    Ok I can't install that on windows 2008 or Windows 7. What do I do there?
  • Geraint Jones
    Geraint Jones over 13 years
    You can use the 2003 version : serverfault.com/questions/141168/…
  • Justin Dearing
    Justin Dearing over 13 years
    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
  • Kiquenet
    Kiquenet over 9 years
    How can I do this task in remote computer ?