Search This Blog

Use InstallUtil to Install the Windows Service

The following instructions will guide you in installing your new service.

Open a Visual Studio .NET Command Prompt
Change to the bin\Debug directory of your project location (bin\Release if you compiled in release mode)
Issue the command InstallUtil.exe MyWindowsService.exe to register the service and have it create the appropriate registry entries
Open the Computer Management console by right clicking on My Computer on the desktop and selecting Manage
In the Services section underneath Services and Applications you should now see your Windows Service included in the list of services
Start your service by right clicking on it and selecting Start
Each time you need to change your Windows Service it will require you to uninstall and reinstall the service. Prior to uninstalling the service it is a good idea to make sure you have the Services management console closed. If you do not you may have difficulty uninstalling and reinstalling the Windows Service. To uninstall the service simply reissue the same InstallUtil command used to register the service and add the /u command switch.

3 comments:

Unknown said...

Hey man thanks for this ... had completely forgotten how :) now its all coming flooding back :)

Vlad said...

Is the InstallUtil.exe always available on a Windows machine? Does anyone know? I need to distribute my service but not sure if I need to create my own setup project, or use services like http://installer.codeeffects.com, or rely on sc.exe, or what? Thanks in advance to anyone for any info on this.

Unknown said...

Great post. I hope you can write more good stuff like this article.

Managed It Services RI