Simple way to install a service multiple times on a Windows server?

I have written a Windows service. I wish to install the same service multiple times on the same machine.

Changing the service name for the new instance is desirable.

Is there an easy way to do this? I tried copying the executable to a different location and renaming it but this did not work when I tried installing it with installutil.exe (it noticed I had already installed the service.)

I would rather not have to recompile and change the default name of the service if I can help it! Is there something I have missed in my Interwebs search that will let me do this?

Try the native application sc.exe.

You might also want to look up srvany.exe and instsrv.exe

These are older tools that are included in the freely available resource kits for Windows. I am not very familiar with their use, but I have used them in a small school environment with WPKG to deploy a service to all machines.

As mentioned above, I would just use the standard sc command line program that comes with Windows. You should be able to use the same executable for multiple services, as long as each instance is given a different name and they are all installed as “own process” instead of “shared process”.

May I ask if this is just something for internal use only, or is this something that will be deployed to a wider audience? If this is something intended for end users, a design that requires the app to be installed as multiple instances of a service will likely complicate the installation process and increase the probability that something might get messed up. It might not be a bad idea to take a step back and see if it is feasible to shuffle things around so that you can support everything with just one instance of the service.

Nope, internal. We already are trying to expand it to support everything with one instance, but want to make sure that if something bad in our code causes it to crash, it won’t take down the entire structure :slight_smile:

looks like the sc command worked, thanks everyone! The Googles they told me nothing.