539

I have a couple old services that I want to completely uninstall. How can I do this?

Jon Seigel
  • 12,251
  • 8
  • 58
  • 92
sgwill
  • 9,814
  • 8
  • 35
  • 40

14 Answers14

1007

Use the SC command, like this (you need to be on a command prompt to execute the commands in this post):

SC STOP shortservicename
SC DELETE shortservicename

Note: You need to run the command prompt as an administrator, not just logged in as the administrator, but also with administrative rights. If you get errors above about not having the necessary access rights to stop and/or delete the service, run the command prompt as an administrator. You can do this by searching for the command prompt on your start menu and then right-clicking and selecting "Run as administrator". Note to PowerShell users: sc is aliased to set-content. So sc delete service will actually create a file called delete with the content service. To do this in Powershell, use sc.exe delete service instead


If you need to find the short service name of a service, use the following command to generate a text file containing a list of services and their statuses:

SC QUERY state= all >"C:\Service List.txt"

For a more concise list, execute this command:

SC QUERY state= all | FIND "_NAME"

The short service name will be listed just above the display name, like this:

SERVICE_NAME: MyService
DISPLAY_NAME: My Special Service

If you want to make sure you are using the right name you can run:

SC QUERY MyService

If the name is right it will display some info about it; otherwise it will give an error.

And thus to delete that service:

SC STOP MyService
SC DELETE MyService
Lasse V. Karlsen
  • 380,855
  • 102
  • 628
  • 825
  • 5
    Deleting the SSDP Discovery Service? It is used for detecting and configuring UPnP devices on the local network, you should not delete it. It was just used as an example. – Lasse V. Karlsen Sep 16 '08 at 20:00
  • 5
    Oooh, I see, yes. I thought you meant deleting services wasn't recommended. Thanks for the answer! – sgwill Sep 16 '08 at 20:07
  • 19
    I wonder how many sysadmins have already accidentally deleted their SSDPSRV service purely because of this answer :p – Vincent Vancalbergh Jun 11 '14 at 08:52
  • 3
    It should be noted that you have to run CMD as Administrator. (Right click on CMD and choose Run as Administrator) to run many of these commands. – Highway of Life Jul 17 '14 at 19:29
  • 7
    Use `sc query state= all` to get the full list of services; basic `sc query` will not return inactive (aka. disabled) services. – tricasse Sep 02 '14 at 21:05
  • @tricasse Thank you! I have added your remark to the original answer. – Greg Dubicki Mar 10 '15 at 22:52
  • 47
    Note that if you're using PowerShell, `sc` is aliased to `set-content`. So `sc delete service` will actually create a file called `delete` with the content `service`. To do this in Powershell, use `sc.exe delete service` instead. – KFL Oct 02 '15 at 05:14
  • If your using powershell... substitute sc.exe instead of sc, otherwise the function returns without removing the service. – andrew pate Feb 24 '17 at 14:45
  • Please note that if service have spaces in name, you have to wrap full name into quotation marks - `sc delete "Amazon Assistant Service"`. Also, the exact service name is to be found in registry `HKLM\SYSTEM\CurrentControlSet\Services\{xxyy}\DisplayName` – Jan 'splite' K. May 10 '17 at 09:17
  • FYI: For PS fans it looks like this has recently been added to **PowerShell Core** (NB: different to standard PowerShell). Pull Request: https://github.com/PowerShell/PowerShell/pull/4858 Code: https://github.com/PowerShell/PowerShell/blob/master/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs#L2211 – JohnLBevan Apr 06 '18 at 09:37
  • SC STOP shortservicename SC DELETE shortservicename – Jayani Sumudini Jul 23 '18 at 03:01
  • 1
    on PowerShell, use "C:\Windows\System32\sc.exe" (or "sc.exe") instead of "SC" – MovGP0 Jan 24 '19 at 10:24
  • Thanks! that note about powershell was epic, quite scary how much time I could have lost without it. – eglasius Feb 19 '19 at 10:25
  • @eglasius Thank [@zelusp](https://stackoverflow.com/users/3491991/zelusp) for that, as he was the one editing it in. – Lasse V. Karlsen Feb 20 '19 at 22:58
71

Click Start | Run and type regedit in the Open: line. Click OK.

Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

Scroll down the left pane, locate the service name, right click it and select Delete.

Reboot the system.

Chandra Sekhar
  • 16,256
  • 10
  • 67
  • 90
Mark Schill
  • 2,238
  • 14
  • 10
  • 3
    This is a good fallback when the executable hosting the service has been deleted (not uninstalled), and the preferred `sc delete` mechanism fails. Thanks. – holtavolt Oct 08 '18 at 14:13
  • Thanks for adding Reboot the system. I created a service with a bad path in one of the parameters and it wasn't starting properly so I deleted it, fixed the path and tried to create it again only to get errors that the service was marked for deletion. – Mike Devenney Dec 20 '21 at 21:42
39

As described above I executed:

sc delete ServiceName

However this didn't work as I was executing it from PowerShell.

When using PowerShell you must specify the full path to sc.exe because PowerShell has a default alias for sc assigning it to Set-Content. Since it's a valid command it doesn't actually show an error message.

To resolve this I executed it as follows:

C:\Windows\System32\sc.exe delete ServiceName
Nic
  • 12,220
  • 20
  • 77
  • 105
28

Use services.msc or (Start > Control Panel > Administrative Tools > Services) to find the service in question. Double-click to see the service name and the path to the executable.

Check the exe version information for a clue as to the owner of the service, and use Add/Remove programs to do a clean uninstall if possible.

Failing that, from the command prompt:

sc stop servicexyz
sc delete servicexyz

No restart should be required.

asquithea
  • 575
  • 5
  • 8
  • 4
    Please note that if service have spaces in name, you have to wrap full name into quotation marks - like `sc delete "Amazon Assistant Service"` – Jan 'splite' K. May 10 '17 at 09:17
23
SC DELETE "service name"

Run the command on cmd as Administrator otherwise you will get this error :-

openservice failed 5 access is denied

Nisarg Shah
  • 14,151
  • 6
  • 34
  • 55
Sachidananda naik
  • 391
  • 1
  • 3
  • 11
10

If you have Windows Vista or above please run this from a command prompt as Administrator:

sc delete [your service name as shown in service.msc e.g moneytransfer]

For example: sc delete moneytransfer

Delete the folder C:\Program Files\BBRTL\moneytransfer\

Find moneytransfer registry keys and delete them:

 HKEY_CLASSES_ROOT\Installer\Products\
 HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\
 HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\EventLog\
 HKEY_LOCAL_MACHINE\System\CurrentControlSet002\Services\
 HKEY_LOCAL_MACHINE\System\CurrentControlSet002\Services\EventLog\
 HKEY_LOCAL_MACHINE\Software\Classes\Installer\Assemblies\ [remove .exe references]
 HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Folders

These steps have been tested on Windows XP, Windows 7, Windows Vista, Windows Server 2003, and Windows Server 2008.

Chris
  • 3,113
  • 26
  • 33
user2145033
  • 101
  • 1
  • 2
9

We can do it in two different ways

Remove Windows Service via Registry

Its very easy to remove a service from registry if you know the right path. Here is how I did that:

  1. Run Regedit or Regedt32

  2. Go to the registry entry "HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services"

  3. Look for the service that you want delete and delete it. You can look at the keys to know what files the service was using and delete them as well (if necessary).

Delete Windows Service via Command Window

Alternatively, you can also use command prompt and delete a service using following command:

sc delete

You can also create service by using following command

sc create "MorganTechService" binpath= "C:\Program Files\MorganTechSPace\myservice.exe"

Note: You may have to reboot the system to get the list updated in service manager.

Community
  • 1
  • 1
Kevin M
  • 5,436
  • 4
  • 44
  • 46
  • 6
    The regedit method didn't work for me. When I refreshed the service manager, it still showed the service, but it had an error stating that it could not display the description. – datguy Dec 12 '14 at 15:51
  • 2
    Note: You may have to reboot the system to get the list updated in service manager. – Kevin M Dec 13 '14 at 05:04
  • 2
    Maybe, but that makes the regedit approach inferior to the SC command, which does not require a reboot. – datguy Dec 13 '14 at 05:09
  • 4
    This messed up my services :( please dont misguide THis stupid goodle, showup this anser in its search page automactically and i trusted it and followed it blindly without clicking the SOF link and I had to reimage my machine. – Anand Rockzz Jan 25 '15 at 05:52
  • thanks for the registry method. only way I could do it on a renegade machine. – frostymarvelous Jun 22 '15 at 13:19
  • and it does work. sometimes with SC Delete, you still need to restart as well. – frostymarvelous Jun 22 '15 at 13:20
  • @AnandRockzz `sc delete` would have also deleted the reg key, same as you did manually. You would just then have to reboot to remove it from services.msc. If it didn't get removed after rebooting, uninstalling the associated application that put the service there in the first place would be your next path. Re-imaging the machine was very drastic, especially as you could just search the registry for that service's name, too, and remove them. – vapcguy Jul 06 '16 at 17:26
  • @AnandRockzz 1st: thanks very much for the warning! 2nd: please down-vote this answer (if you haven't already) if it is wrong/harmful. Also, on the Google result that shows the snippet of this answer, you can leave feedback and tell Google it is wrong/harmful.. If enough people do that, Google might remove it. – stormdrain Nov 08 '17 at 15:48
6

If they are .NET created services you can use the installutil.exe with the /u switch its in the .net framework folder like C:\Windows\Microsoft.NET\Framework64\v2.0.50727

CPU_BUSY
  • 781
  • 2
  • 5
  • 15
5

This did the job for me on Windows 10:

  • start the cmd.exe as admin
  • run SC DELETE "com.docker.service"
  • reinstall docker
4F2E4A2E
  • 1,964
  • 26
  • 28
2

sc delete name

Mariano
  • 2,928
  • 6
  • 25
  • 28
2

Here is a vbs script that was passed down to me:

Set servicelist = GetObject("winmgmts:").InstancesOf ("Win32_Service")

for each service in servicelist
    sname = lcase(service.name)
    If sname = "NameOfMyService" Then 
        msgbox(sname)
        service.delete ' the internal name of your service
    end if
next
Daniel Morritt
  • 1,787
  • 17
  • 25
Lucas
  • 158
  • 1
  • 2
  • 8
1

Before removing the service you should review the dependencies.

You can check it:

Open services.msc and find the service name, switch to the "Dependencies" tab.

Source: http://www.sysadmit.com/2016/03/windows-eliminar-un-servicio.html

1

You can use my small service list editor utility Service Manager

Preview

You can choose any service > Modify > Delete. Method works immediately, no reboot required.

Executable file: [Download]

Source code: [Download]

Blog post: [BlogLink]

Service editor class: WinServiceUtils.cs

Sergey Vaulin
  • 722
  • 4
  • 16
0

For me my service that I created had to be uninstalled in Control Panel > Programs and Features

Demodave
  • 6,242
  • 6
  • 43
  • 58
  • how can you see the services installed in programs and features – Nisha May 05 '17 at 08:05
  • If I remember correctly, this was when the program I had which I believe was splunk, after installed, ran as a service because it was hosting locally you could go to localhost:8080 to view the local website. In order for me to remove it, I had to the entire program. – Demodave May 05 '17 at 13:35
  • Thank you. I installed teh services using command prompt. I deleted using a cmd in cmd pmpt . Thanks again for replying. – Nisha May 09 '17 at 07:55