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

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Tuesday, September 23, 2008 2:42 PM

Thanks much!!! I hate rebooting.

ctupper

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Thursday, October 09, 2008 8:39 AM

Good Article. Know exactly how you felt.

KVK Consultancy

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Friday, November 07, 2008 4:41 PM

Thank you!

Some shameless plugs:

without reboot

delete services without reboot

nt services wont remove

windows services wont remove

"This Service is marked for deletion"

Very Greatfull!!!!!

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Friday, November 14, 2008 4:53 PM

THANK YOU VERY MUCH

Colby

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Saturday, November 15, 2008 4:18 PM

Thanks for the tip!

Dan Hintea

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Monday, December 15, 2008 5:37 AM

Thanks!! This really helped.

Anand Muddi

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Monday, March 02, 2009 3:53 AM

Thanks!! This really helped.

kaushalparik27

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Sunday, April 12, 2009 3:29 AM

Wow.  I can't believe I had to google for a blog post to get an answer for this.

Thank you for writing this up so I didn't have to keep restarting my computer all night.

PeterBrunone

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Wednesday, May 27, 2009 6:43 AM

Thanks so much for this.. this restarting or logging off the system was driving me crazy.. Actually felt foolish on realizing that the solution was so simple..

Rohonesh Kar

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Monday, June 22, 2009 10:48 AM

That's what I wanted..Thanks!!!

Ajay Kewale

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Friday, June 26, 2009 5:50 AM

OMG me life saver!

yayai

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Wednesday, September 23, 2009 5:21 AM

Man, ty!! it just drive me crazy!

and such a simple solution. i LOL`ed!

Miahoo

# re: Windows Services, services.msc and the "This Service is marked for deletion" error.@ Monday, November 02, 2009 1:57 PM

Wow! you're the man

ruben ruvalcaba

Leave a Comment

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