Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot uninstall a windows service: "...cannot be deleted, because it's equal to the log name."

I need to uninstall a Windows Service I have created, but I get this error using the "Uninstall or change program" program in windows:

Error. An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalled after the uninstall is complete. -> The event log source '111 My Service' cannot be deleted, because it's equal to the log name.

Then I click "OK" and the program remains listed in the list of installed programs. What is worse, I cannot install a new version of it. The windows installer says that another version of this product is already installed and I should uninstall it first. How do I get rid of this program?

Update Here is what is happening when I run InstallUtil.exe /u command on it.

The uninstall is beginning. See the contents of the log file for the C:\MyService.MyService. assembly's progress. The file is located at C:\MyService.MyService.InstallLog. Uninstalling assembly 'C:\MyService.MyService.exe'. Affected parameters are: logtoconsole =
assemblypath = C:\MyService.exe
logfile = C:\MyService.MyService.InstallLog Removing EventLog source 111 My Service. An exception occurred during the uninstallation of the System.Diagnostics.EventLogInstaller installer. System.InvalidOperationException: The event log source '111 My Service' cannot be deleted, because it's equal to the log name. An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalle l is complete.

The uninstall has completed. An exception occurred while uninstalling. This exception will be ignored and the uninstall will continue. However, the application might not be fully uninstalle l is complete.

like image 670
Kasper Hansen Avatar asked Mar 18 '11 14:03

Kasper Hansen


4 Answers

Try to execute next command in cmd:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe /u "c:\myservice.exe"

The second option is:

sc delete <service name>

After running the line above you can try to remove the service branch as well in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services.

like image 95
akrisanov Avatar answered Nov 15 '22 04:11

akrisanov


The accepted answer didn't work for me.

What worked is open regedit in administrator mode and find the service and delete it.

like image 37
Indu kolli Avatar answered Nov 15 '22 02:11

Indu kolli


I had the exact same problem (and nothing in the selected answer worked).

Surprisingly, what fixed the problem was (using the standard "Uninstall or change program" or "Programs and Features" windows dialog) right-clicking on the program and choosing repair (this was apparently successful), and then uninstalling.

like image 23
tintin Avatar answered Nov 15 '22 03:11

tintin


This just happened to me and the solution above didn't work where you run the InstallUtil.exe or delete the service. I had initially set up my service with the "LocalSystem" security context, and it was installed with that. I later changed the security context to "User" and recompiled the service executable and tried to uninstall the old service. The error messages were coming up that are described here, and once I went and changed the security context back to "LocalSystem" I could fully uninstall.

In other words, you might want to uninstall your old service with the executable it was created with rather than a newer one with possible modifications.

like image 1
deadflowers Avatar answered Nov 15 '22 02:11

deadflowers