Installing Jenkins agent as service on win8.1 and win10
Asked Answered
U

4

24

I am trying to install Jenkins agent service after starting the slave via web start. I get the following error when it tries to install on windows 10 and windows 8.1.

[JenkinsWorkDirectory]$ c:\JenkinsWorkDirectory\jenkins-slave.exe install
WMI.WmiException:AccessDenied
at WMI.WmiRoot.ClassHandler.Invoke(Object proxy, MethodInfo method, Object[] args)
at WMI.Win32ServicesProxy.Create(String, String, String, ServiceType, ErrorControl, StartMode, Boolean, String, String, String[])
at winsw.WrapperService.Run(String[]_args,ServiceDescriptor descriptor)
at winsw.WrapperService.Main(String[]args).

I can install the agent service without any issue on win 7. Any idea why is this happening or is it some limitation of Jenkins or am I missing some dependency?

My Jenkins version is 1.655 and using chrome browser when installing. Jenkins controller is running on windows 7.

Unstring answered 8/4, 2016 at 13:0 Comment(6)
Permissions issue? If you plan to have access to a Desktop, i.e. for gui tests, i suggest to use the jnlp method though.Marrilee
Thanks I tried it but TestComplete plugin says to start is as service. In that way i dont need to have an active user session on the slave machine.Unstring
Good luck, i tried it and did not get it to work as service without an active user session. Screenshots would stay black.Marrilee
Could you please elaborate on the screenshot part? I tried it on windows 7 slave working as service and got results fine without any issue.Unstring
For GUI tests your jenkins/testcomplete needs access to a desktop. A system service doesnt have access, however you can change some settings to run as a user and allow desktop interaction, but this didnt work as exspected for me. I added a job which executes a screenshot program to test access. Only got it working with setting autologin for a user and connecting the windows slave via jnlp.Marrilee
It appears the jenkins-slave .net project that was created is missing an installer. See #7922605 I came to this conclusion because of the install log file that contained the error, "No public installers with the RunInstallerAttribute.Yes attribute could be found in the c:\jenkins\jenkins-slave.exe assembly. Committing assembly 'c:\jenkins\jenkins-slave.exe'."Excide
E
61

I found another way to get the slave to install.

  1. Open a command window with "Run as Administrator".
  2. Change directory to the place where you saved the slave-agent.jnlp file.
  3. at the prompt run "slave-agent.jnlp"
  4. Now with the running slave click the menu item to "Install as Service".

The trick is to do it while running as an administrator. This installs the service running under localsystem.

Additionally, if you're like me and you need your jenkins routines to hit another machine, you'll need to change the service to run as a user with permission (network or otherwise) to do the task you want done.

Excide answered 10/5, 2016 at 19:14 Comment(4)
Thank You this helped with my issue.Unstring
Thanks! this solution works for me too. Although according to the Jenkins tutorial I believe that .Net 3.5 needs to be enabled on the Windows 10 machine like so: 1. Windows key+s 2. Search and choose "Turn Windows Features on and off" 3. Tick the ".NET Framework 3.5" box 4. Press OK. you may need to reboot your machine to apply this change. Oh and @AhmedDaniel I think you can close or update your Jira issue now ;-)Labia
Oh I forgot about that. Thanks for reminding, i'll close it now.Unstring
Just to add to Steve Brownell's answer: A fresh "slave-agent.jnlp" file can be downloaded from Jenkins using the node's "/slave-agent.jnlp" endpoint (e.g. myjenkins:8080/computer/node1/slave-agent.jnlp)Mutz
I
10
  1. Open a command window with "Run as Administrator".
  2. Just in case, You may have trouble with the .jnlp in "Steve Brownell" instructions, then, run the first line of your error message, shown below. c:\JenkinsWorkDirectory\jenkins-slave.exe install
Inerasable answered 1/10, 2016 at 15:22 Comment(0)
B
2

goto your downloaded jenkins-slave.exe Application file.

goto properties -> compatibility -.> check run as administrator.

Now try installing it as service again. It will work.

Balfour answered 12/1, 2018 at 22:54 Comment(1)
Works for me. but the environment variable using the global oneAvon
B
2

"C:\Program Files (x86)\Java\jre1.8.0_161\bin\javaws.exe" slave-agent.jnlp just run this from command prompt my issue got resolved from this as an administrator

Bonehead answered 10/11, 2018 at 13:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.