Tuesday, April 12, 2011

Installing and Uninstalling a Windows Service from the Command Line

I develop a windows service every now and then. I always have to dig up the install and uninstall commands. I figured I would post it for all.

Install

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil /LogToConsole=true "<path_to_service_exe>"

Uninstall

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil /u "<path_to_service_exe>"

Make sure to replace <path_to_service_exe> with what works for you.

If you’re on Win7 or Win2008 Server, you’ll need to start your Command Prompt as an administrator.

Cheers.