2

I created an installer and custom actions for a service.

On first install I managed to install the service , but when I tried running the service I got an Error :Windows installer service cant start Error 193:0xc2

I have tried deleting this service in myriad of ways, yet on install I am still getting an error message 1001 The specified service already exists.

I deleted the service directly from the registry , but this does not seem to have worked.

I have tried sc delete [service] --> The specified service does not exist as an installed service.

The service is not showing up in the registry nor is it present in installed services.

Any other thoughts or options would be appreciated

3
  • Did you originally install your service using an msi file? Commented Aug 24, 2011 at 0:34
  • Try using sc create to create the service, if that succeeds then the problem is likely to be with the installer rather than with the service. Commented Aug 24, 2011 at 2:06
  • I can't uninstall my service because the name given by the WindowsService and WindowsServiceInstaller did not match. It is just there, listed but incapable of action, good idea re:regedit, getting somewhere now. Actually a bad idea, more errors but fewer keys in my registry :/
    – John
    Commented Sep 6, 2011 at 19:04

5 Answers 5

2

I have used this commands in a bat file that runs every time reinstalling. Try this and see.

set path=%path%;%SystemRoot%\Microsoft.NET\Framework\vXXX

InstallUtil /u YourService.exe

InstallUtil /i YourService.exe

net start "Service name"

If you want to delete/uninstall/remove a Windows service, perhaps left from an incomplete installer, you can use the sc command from an Administrator control prompt:

sc delete [servicename]

"sc delete" Deletes a service subkey from the registry. If the service is running or if another process has an open handle to the service, then the service is marked for deletion.

EDIT

I have tried sc delete [service] The specified service does not exist as an installed service.

Probably restarting the machine would fix this.

4
  • +1 for sc delete, the Microsoft supplied way to get rid of a service.
    – Ian Boyd
    Commented Aug 23, 2011 at 23:35
  • @ Ian : I came across a similar situation and that was the only working solution I could find.
    – CharithJ
    Commented Aug 23, 2011 at 23:37
  • i presume OP has the wrong service name, or the service actually isn't installed.
    – Ian Boyd
    Commented Aug 24, 2011 at 2:47
  • The OP was using an installer, which, on Windows, should be based on MSI technology. No need to use SC or InstallUtil here. MSI can handle all that stuff on its own. Commented Oct 22, 2011 at 8:14
2
sc.exe stop serviceName
sc.exe delete serviceName

and reboot the your VM\PC

0

This complaint may be coming from the installer, not from Windows.

I had this same issue earlier this year, I installed a service from an MSI file, which fouled up somewhere along the line. I uninstalled the package and tried reinstalling through the installer and got the same message as you did, that the service already existed. Frustrating. It didn't show up as an installed package at all anymore, nor did it show up in the service list.

It ended up that the MSI file did not clean up after itself properly during uninstall, but that I could manually manipulate this database and remove the information myself using MSIZap.exe. You need the Windows SDK to get at this program. There may be other ways, but I don't know of them.

You will need the package guid of your installation package to remove it using MSIZap. In the same directory as MsiZap.exe, you will find another application, MsiDb.exe. Run that, point it at your MSI file, point it to some empty directory to store some exports select the "Property" table, select the "Export" radio button and hit the "OK" button. Open the "Property.idk" file that was generated by MsiDb.exe in any text editor. Look in your text for a line that says "ProductCode". The GUID that follows is what you will feed into MsiZap, brackets and all. Now you will simply (bwahaha... yeah right) enter:

msizap T {product code}

Where "{product code}" is replaced by the GUID you found. This removes all traces of your product from the MSI database in windows, which should shut the installer up.

I realize that all of this is a ridiculous pain in the butt. I don't understand why finding a product code is such a trial. But, I suppose if the uninstaller worked, you wouldn't have to do its job for it now. There really might be a simpler way to do all of this, but I haven't found one. Once I found something that worked, I was over it.

As a final note, what caused this error for me was leaving the services list open during uninstall. An uninstaller which isn't paying attention could ignore some exceptions and leave pieces of itself lying about. I was lucky, the poorly behaving uninstaller was my own. And by the way, to appreciate just how much garbage is left over from uninstallation, check out this article.

I'm not sure if I had the same problem that you had, but if so, I hope this helps. If you need clarification, ask and I'll update the answer. If I'm up a tree and this has nothing to do with your problem, I apologize.

1
  • Michael, First off thank you so much for the detailed explanation. I have downloaded the sdk and will follow the instructions , I will let you know how it turns out.
    – AndyMM
    Commented Aug 24, 2011 at 8:05
0

Try with Powershell and Wmi:

(gwmi win32_service -filter "name='yourservicename'").delete()

Make sure services.msc window is closed. Sometime that messes up the service deletion. I am not sure if this will help, you should not have touched the registry!

0

Perhaps you tried to delete the service while it's running? In that case you might need to reboot to clear things up.

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