I am currently building a Jenkins environment on a Windows server. I would like to register another Windows server as a node and run jobs on that server.
To launch the agent, I have been using the following command in the command prompt (CMD):
You can install the agent as a service (there is a menu option in the GUI of the agent process to do so). One thing to note is that if you need the jobs to interact with the desktop at all, running as a service will not work. Services are not allowed to interact with the desktop.
I was hoping to run the agent under a specific user context, so I understand that running it as a service would not be suitable in that case—especially if the job needs to interact with the desktop.
Does this mean that the only option is to keep the command prompt window open if I want to run the agent interactively under a user session?
IIRC if you use javaw rather than java, then Windows doesn’t open a console window, but the process will still be able to interact with the desktop. I haven’t tried running Jenkins agents in this way though.
In the CreateProcess API, there are also options to start a console application (such as java.exe) without a console, or with a hidden console window. The latter seems to be surfaced in PowerShell as Start-Process -WindowStyle:Hidden.
You mention ”auto-start” in the thread title. Apart from services and shortcuts, you can also set up auto-start as a scheduled task that starts when a specific user logs in, and that can be configured to allow interacting with the user’s desktop.