en-US - - English

How to create a service

Adding services to an account

For this, you need a program called NSSM (Non-Sucking Service Manager), which you can download from https://nssm.cc/download. It is worth downloading it to your own computer first, and copying it from there to the remote target (Ctrl+C, Ctrl+V). Put it preferably in the root of the C drive.

Use the command prompt (cmd.exe) in administrator mode. With cd .., listing subfolders with dir, and entering folders with cd folder name, go all the way to C:\(…)nssm 2.24\win64>. There, run the following command. At its end, use a meaningful service name, because that becomes the name of your new service:

C:\nssm 2.24\win64>nssm install notepadservice

(In this example, we make a service from Notepad.exe, which normally runs as a process while you use it, not as a service that always runs in the background.)

The NSSM tool opens:

  • Browse for, for example, the Notepad.exe file.
  • You can set whether the service starts by hand or automatically (we prefer automatic).
  • On the Log on tab, give the user and password combination (the password twice).
  • Select Install Service.

You should see a message like this: service "XYZ" installed successfully!

Find your new service: in the Start menu, type Services. You can then see it in the list; on the far right, you also see which user the service belongs to. Right-click to start the service.

With the right PassMan settings, the password of the service can now also be changed, whether it is running or stopped at the time. After the remote connection is closed, or when the remote machine restarts, the new password must be used. Services set to automatic start by themselves after a restart. When started by hand, they must also run with the current (new) password.

Deleting a service

Start the command prompt (right-click) as an administrator, and run:

sc delete ServiceName

where ServiceName is the name of the service you want to delete.