Sunday, January 23, 2011

Can't uninstall windows service

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.

UPDATE:

...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

HKEY_CURRENT_USER\Software\Microsoft\Windows\ShellNoRoam\MUICache

HKEY_CLASSES_ROOT\Installer\Products...

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products...

etc...

  • 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.

    Chad : @Bart Silverstrim, I don't see anything, but I'm not sure what I'm looking for, I have 2810 events when running InstallUtil
    Bart Silverstrim : 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 :-)
  • 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!

    From Chad

0 comments:

Post a Comment