Install and Uninstall Windows Service from C# Console Application

less than 1 minute read

InstallUtil.exe should be on the computer.
It’s usually installed with .NET in a path similar to this C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe.

Installing

installutil.exe TestService.exe

Uninstalling

installutil.exe /u TestService.exe

If for some reason, there are problems with above method, try these as administrator. It is best to specify full path to the exe file.

Installing

sc create NameOfService binPath= TestService.exe
(space after the = is important)

Uninstalling

sc delete NameOfService

Leave a Comment