How to force uninstallation of windows service
I installed a windows service using installUtil.exe.
After updating the code I used installUtil.exe again to install the service w/o uninstalling the original version first.
When I now try to uninstall the service, installUtil.exe completes the uninstall successfully, but the service still appears.
If I try to change its properties, I receive the message 'service is marked for deletion'.
How can I force the deletion (preferrably w/o restarting the server)?
One thing that has caught me out in the past is that if you have the services viewer running then that prevents the services from being fully deleted, so close that beforehand
You don't have to restart your machine. Start cmd or PowerShell in elevated mode.
sc.exe queryex <SERVICE_NAME>
Then you'll get some info. A PID number will show.
taskkill /pid <SERVICE_PID> /f
Where /f is to force stop.
Now you can install or launch your service.
well, you can use SC.EXE to delete any windows Service forcefully if un-install doesnt removes by any chance.
sc delete <Service_Name>
Read more on "MS Techno Blogging" Deleting Services Forcefully from Services MMC
I know this isn't going to help, but it might help someone in the future.
I've just had the same problem, closing and re-opening the services manager removed both the entry from the registry and completed the uninstall of the service.
Previous to that, refreshing the services manager hadn't helped.