Knowledge Base

How to uninstall a service

Problem:

You are not able to uninstall a service from the software menu. Uninstalling the whole software from Add/remove programs and restarting a system also fails.

There are three methods available to manually uninstall a service. Please be aware that uninstalling any CodeTwo service following steps below may get you to a point where the whole CodeTwo software will not work and the full reinstallation will be required. Go for manual service removal option only if you know what you are doing.

Solution 1 - sc.exe:

There is a special tool for services manipulation delivered with Windows (sc.exe). Using it is the recommended way of manually deleting a Windows service.

  1. Start Windows command line (cmd.exe).
  2. Type in and execute the following command. On the list of services find the short name of the service in question by the SERVICE_NAME label:
    sc query
  3. Type in and execute the below command swapping <SERVICE_NAME> for the service name. This will stop the service if it is still running.
    sc stop <SERVICE_NAME>
  4. Type in and execute the below command swapping <SERVICE_NAME> for the service name. This will uninstall the service.
    sc delete <SERVICE_NAME>

If for some reason the sc command does not work please navigate to the below path (where sc.exe file is located) and try again:

C:\Windows\System32\

To find out more on sc.exe please refer to this Microsoft article.

Solution 2 - InstallUtil.exe:

If you trying to uninstall a .NET created service, aside from sc.exe you can also use a .NET tool - InstallUtil.exe. This method will be useful for developers and "power users".

  1. If you are a developer using MS Visual Studio go to Visual Studio, Visual Studio Tools, Developer Command Prompt. Alternatively Start Windows command line (cmd.exe) and navigate to appropriate .NET framework folder where InstallUtil.exe tool is located. The default path is as presented below where <64> is optional and <framework_ver> is the exact .NET version number. You need to use the tool for appropriate architecture and matching .NET version.
    %WINDIR%\Microsoft.NET\Framework<64>\<framework_ver>\
    For example:
    C:\Windows\Microsoft.NET\Framework\v3.5\
    or
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\
  2. Type in and execute the following command. You need to know the service exe file and fit it in <service_executable> below:
    installutil /u <service_executable>.exe

If you need more details on this method please refer to this Microsoft article.

Solution 3 - registry modification:

The manual Windows registry modification method is recommended only for experienced users. Improperly edited Windows registry may get permanently corrupted.

  1. Start Windows registry editor (regedit.exe) and navigate to the below path:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
  2. Delete registry subkey related to the service in question.
  3. Restart Windows.

See also:

Was this information useful?