Windows Service – Is It Installed Globally?

servicewindowswindows-service

I have coded a simple c# windows service.If its installed using installutil ,will the service be available for all users of the system?

In case of server operating system,under what account the service should be installed so that it will start automatically on server startup?

Please throw some light on this.

Best Answer

Yes. Ordinary Windows services are inherently global; it makes no difference which account was used to install the service. So far as I'm aware, Windows doesn't even record that information.

You do need to have administrator privilege in order to install a service.

To configure a service to start automatically with Windows, configure the service start type appropriately. See step 5 in How to: Add Installers to Your Service Application.

Addendum: if the service is running in a domain account, it might in some situations be necessary to configure the service for a delayed start. This answer explains how to do that in .NET. If the service runs normally when started manually but generates "invalid username or password" type errors when starting automatically, configuring it for delayed start may help. I'm not sure yet of the underlying cause of the problem.

(If a service uses the SERVICE_USER_OWN_PROCESS or SERVICE_USER_SHARE_PROCESS type, then there are separate instances of the service for each logged on user, and the behaviour of this sort of service does not appear to be properly documented. However, I believe the answer is the same: the installation is still global and it still makes no difference which account installs the service.)