Miscellaneous Debris

Avner Kashtan's Frustrations and Exultations
Windows Services, services.msc and the "This Service is marked for deletion" error.

In my current project, we have a windows service that we are developing and debugging, which involves a lot of installing/uninstalling the service. One common problem when uninstalling a service is that while the uninstallation is successful, you still see the service listed in the Services console(services.msc). If you try to start it, stop it or uninstall it again (using installutil.exe or sc delete) you get an uninformative "This service has been marked for deletion".

The KB article about this problem suggests you restart the computer, which is pretty much overkill. Sure, it'll work, but you'll never find out what caused it in the first place. Turns out it's a pretty simple affair: just make sure you close the Services console, which apparently holds a handle of some sort to it. You don't have to do it before you uninstall. The minute you close the console, all services marked for deletion will be deleted, and all will be well.

When doing it on a server, it's important to make sure you've closed all Services consoles on all active sessions. I've seen this error happen when no console was open, and it was fixed by running Task Manager and killing all instances of mmc.exe. I could have logged on to the other sessions and closed it gracefully, but I was lazy. Did the trick.

Published Wednesday, September 05, 2007 12:14 PM by Avner Kashtan

Comments

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Thursday, September 06, 2007 10:04 AM

bob.yexley.net/.../net-windows-services-tricks

Yex

# Windows Services, services.msc and the "This Service is marked for deletion" error.@ Wednesday, November 28, 2007 6:58 AM

Pingback from  Windows Services, services.msc and the "This Service is marked for deletion" error.

Windows Services, services.msc and the "This Service is marked for deletion" error.

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Wednesday, April 16, 2008 6:26 PM

This was driving me crazy.  I am working on a service and have to uninstall/reinstall it repeatedly, but sometimes I accidentally uninstall twice in a row and this happens.  Hurray for internet search :)

THANK YOU!

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Tuesday, April 22, 2008 9:16 PM

the window service.msc for deletion error pleae rover this my desk top I RUN windows XP ON MY DESKTOP

martin r davissr

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Wednesday, April 23, 2008 8:31 AM

Thank you Avner.

Looks like Microsoft Needs You!

rpgivpgmr

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Tuesday, July 15, 2008 1:38 PM

Just what I needed to know!

Justin

# services msc@ Wednesday, July 23, 2008 11:52 AM

Pingback from  services msc

services msc

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Sunday, August 24, 2008 8:39 PM

what r the services that run when MOM is running.

Salman

Leave a Comment

(required) 
(required) 
(optional)
(required)