I have somehow managed to half uninstall a windows service I was developing.

In no particular order

  • It won't delete if I use sc delete servicename

  • It gives an exception using installutil /u pathtoservice.exe

    "specified service does not exist as an installed service"

  • And using the installer/uninstaller obviously doesn't work either

  • It's no longer in the Services listing

  • It's not shown if I use sc query

  • And I have rebooted

I don't know what else to do, but something still exists, because attempting to install fails because it already exists.

Please help.


...Could it be the stuff in the registry elsewhere?

HKEY_CLASSES_ROOT\Installer\Assemblies\D:|Program Files|[path to].exe

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Assemblies\D:|Program Files|[path to].exe





  • @l0c0b0x, none of the three options given work, sc delete fails, delserv is the same, and the registry contains nothing under that key with the service name – CaffGeek May 20 '10 at 15:21
  • What happens if you delete the key with the service name? – Bart Silverstrim May 20 '10 at 15:25

I'd try downloading the sysinternals suite from Microsoft (free download) and run procmon and/or regmon and/or Filemon (although procmon is supposed to merge their functionality) and see where in the install process there's a fail or denied message and look there to hunt down why your installer thinks it's already installed. Hopefully it might give a clue as to what's going on.

  • I don't see anything, but I'm not sure what I'm looking for, I have 2810 events when running InstallUtil – CaffGeek May 20 '10 at 15:44
  • Anything that says "denied" or "failed" as a result, or at the point where you have the failure towards the end of the program run you stop monitoring and see what is happening near the end of the trace, what the last files and keys were that were being accessed :-) – Bart Silverstrim May 20 '10 at 15:55

Finally found a combination that worked.

  • UnInstall with InstallUtil /u

  • ReInstall with InstallUtil /i

  • Then uninstall with the SetupProject

If I tried to uninstall with InstallUtil, it wasn't right. If I tried to install with the Setup project it failed.

It was this specific combination that got everything into the correct state again so that I can use the setup project to once again install AND uninstall.

...not to self. Never hit cancel during the installation of a service again!

  • I had the same problem as you and this solved it for me too. You should consider marking this as the answer. – Chris Feb 14 '11 at 15:20

protected by Iain Oct 8 '11 at 12:36

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.