Unable to restart Jenkins via URL

Hi,

I am unable to restart Jenkins via the URL using

https://jenkins.domainname.com/restart

I receive the following errors in the logs:

2022-10-18 13:17:33,161 DEBUG - Starting WinSW in the CLI mode
2022-10-18 13:17:33,411 INFO - Restarting the service with id ‘jenkins’
2022-10-18 13:17:33,411 DEBUG - Completed. Exit code is 0
2022-10-18 13:17:33,536 DEBUG - Starting WinSW in the CLI mode
2022-10-18 13:17:33,692 INFO - Restarting the service with id ‘jenkins’
2022-10-18 13:17:33,708 FATAL - WMI Operation failure: AccessDenied
WMI.WmiException: AccessDenied
at WMI.WmiRoot.BaseHandler.CheckError(ManagementBaseObject result)
at WMI.WmiRoot.InstanceHandler.Invoke(Object proxy, MethodInfo method, Object arguments)
at winsw.WrapperService.g__Restart|33_5(<>c__DisplayClass33_0& )
at winsw.WrapperService.Run(String _args, ServiceDescriptor descriptor)
at winsw.WrapperService.Main(String args)

Please let me know if more detailed information is needed.

Thank You!

Seems like the user running jenkins can’t restart the service. I don’t run things on windows so I can’t point you where to change security for processes.

Thanks @halkeye

This was an odd one, as the Windows Service permissions were correct and the permissions to run the WinSW program (Jenkins.exe) were also correct.

What fixed the issue for me was checking “Run as Administrator” for Jenkins.exe

After doing so and restarting the server, I am able to restart Jenkins from a browser without issue