23

I want to install a TeamCity BuildAgend as a user. When entering my user credentials here:

enter image description here

I always get this error:

enter image description here

NOTE: My account (user) is Administrator with full permission!

How can I do this?

Dylan Corriveau
  • 2,561
  • 4
  • 29
  • 36
A-Sharabiani
  • 17,750
  • 17
  • 113
  • 128

3 Answers3

61

The error message says it does not have "enough rights to run as a service",
this is slightly different from just being an administrator.

  1. Go to Control Panel> Administrative Tools> Local Security Policy.
  2. Select Local Policies> User Rights Assignment.
  3. Scroll down through the list of policies and look for Log on as a service.
  4. Add the account you're using to the list of accounts with this right.

That should in theory be all you need to allow the service to run under that user.

Nanhydrin
  • 4,332
  • 2
  • 38
  • 51
  • @Kamrad not a clue I'm afraid. Maybe have a look for something called secedit? I think it might be the command line equivalent executable but I don't know what versions of Windows it's available on or how to use it. – Nanhydrin Aug 28 '15 at 11:34
  • 1
    Actually I found solution already, You should download NTRights.exe http://www.microsoft.com/en-us/download/details.aspx?id=17657 and then go to directory where it was installed and run next command ntrights +r SeServiceLogonRight -u userName -m \\COMPUTERNAME – Shell Scott Aug 28 '15 at 12:42
  • After setting this I just re-ran the installer and this time it worked fine. – Jeff Neet Aug 26 '17 at 00:59
  • 1
    This link may be helpful for those trying to do this on Windows 10: https://learn.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/user-rights-assignment – Phil Ringsmuth Jun 26 '18 at 21:07
  • This worked for the error, but now my agents are in a disconnected state. I've even restarted the server for good measure. Any thoughts? – JP Damstra May 05 '20 at 16:53
  • @JPDamstra, there's usually something in the agent logs to indicate why they won't start. Occasionally I find they take forever to upgrade, or get stuck in a loop of restarting. – Nanhydrin May 11 '20 at 22:57
2

The best powershell command that I have found for this is:

Grant-Privilege -Identity $SERVICE_USERNAME -Privilege SeServiceLogonRight

Requires use of the Carbon framework.

jmsb
  • 4,846
  • 5
  • 29
  • 38
1

I'm a Windows 10 Home user and the steps above did not work for me, but the following did:

  1. Enable gpedit.msc by running the batch file as explained here under Method 1: https://www.askvg.com/how-to-enable-group-policy-editor-gpedit-msc-in-windows-7-home-premium-home-basic-and-starter-editions/
  2. Run gpedit.msc enter image description here
  3. Go to Local Computer Policy / Computer Configuration / Windows Settings / Security Settings / Local Policies / User Rights Assignment enter image description here
  4. Double-click Log on as a service
  5. On the window that appears, click Add User or Group... enter image description here
  6. Enter your username and click the Check Names button enter image description here
  7. Your name will be modified, adding the machine name as the prefix. Click OK enter image description here
  8. Click OK on the Log on as a service Properties window to apply the change. enter image description here

It is a little bit of a pain, but after doing that, I was able to continue installing TeamCity

Victor Chelaru
  • 4,491
  • 3
  • 35
  • 49