0

I am trying to start Jenkins service but via CMD. This service requires specific credentials, because I set up Jenkins to run only with specific account, not as local system account. When I type:

runas /profile /user:user_1 "net start Jenkins"

CMD asks me for password so I type it correctly - when I typed incorrect one for test I received

1326: The user name or password is incorrect.

However even when I type correct user and password I get

Attempting to start net start Jenkins as user "Z1\user_1" ...

and uknown window seems to appear for a split second. When I open services it shows that Jenkins hasn't started. How can I run specific services that requires credentials from cmd? I know I can run CMD as administrator, but I would like to know another way.

6
  • You are trying to approach this as if it is *nix. It is not. In windows, you don't spawn a service like this. You ask the service control manager to spawn one for you. In windows, the user that a particular service runs as is controlled by the service control manager and your service registration, not you simply spawning a process AS some user. Windows has a way of dealing with an entry point that is different than a standard application. Commented Jan 31, 2023 at 20:51
  • Hrm.. I should read more before typing. In windows, your service registration controls who something runs as. Change the user in the service registration and use net start to spawn it. Use the Computer Management console -> Services to change your user. Commented Jan 31, 2023 at 20:57
  • I do not understand you completely but it is possible to run service from cmd with "net start SERVICE_NAME" however Jenkins requires to be started with administrator account on my computer. Commented Jan 31, 2023 at 20:58
  • Maybe there is a way to open cmd window as administrator from cmd window if I am logged in to my computer as administrator. If cmd is opened in administrator mode it is enough to type "net start Jenkins" and no access is denied Commented Jan 31, 2023 at 21:00
  • See this post on StackOverflow. Commented Jan 31, 2023 at 21:09

0

You must log in to answer this question.

Browse other questions tagged .