Delete a service manually from Service Control Manager

Yesterday one of my team members was uninstalling SQL Server 2000 on a Windows Server 2003 cluster. The uninstallation completed successfully through Add/Remove Programs applet. But the MSSQLSERVER and SQLSERVERAGENT services were still getting listed in the Service Control Manager (services.msc).

However the services could not be started because the requisite binary files have already been cleared up during the uninstallation. This issue happened because the entries related to the SQL Server services were still present in the Windows Registry.

This can be resolved in two ways. One is to delete the relevant key from the Registry and the second one is to use the sc.exe.

The MSSSQLSERVER and SQLSERVERAGENT keys can be manually deleted from Windows Registry as in the below screenshot.

But I always choose the Registry Modifications as the last resort. Since there is a more easier way of doing it through sc.exe, why choose any other option? This utility can be used to Create, Start, Stop, Pause, Query the services. It also has the option to delete the service details from the Registry. The syntax of this command is as below.

sc delete MSSQLSERVER

After executing this command, the services did not appear in the Service Control Manager and the DBA proceeded with the re-installation of SQL Server as planned.