105

Last time I create WAS profile and WASService then I try to config and run many script for learn how to config WAS, Finally it crash so i use wasprofile delete this profile and forgot delete WASService.

Now I found IBM Webphere Application Server service display in services.msc list, so I tried to delete it with WASService.exe -remove command and windows SC command but I got message

C:\Program Files\IBM\WebSphere\AppServer\bin>sc delete "IBMWAS61Service - DEV"
[SC] DeleteService FAILED 1072:
The specified service has been marked for deletion.
AngocA
  • 7,352
  • 4
  • 34
  • 51
Fuangwith S.
  • 5,254
  • 8
  • 34
  • 39

10 Answers10

208

make sure the service is stopped, the services control panel is closed, and no open file handles are open by the service.

Also make sure ProcessExplorer is not running.

Josh Petitt
  • 8,633
  • 10
  • 50
  • 95
StingyJack
  • 17,990
  • 7
  • 58
  • 115
  • 2
    In Windows Server 2008, the deletion was successful when I closed the "server management" window. Next time I tried deletion the error was "no service registered". – Alfabravo Mar 10 '11 at 13:11
  • 25
    @Alfabravo: Same thing happened to me, although in my case I had the "Services" window open. As soon as I closed it I was golden. – Cory Grimster Apr 04 '11 at 20:17
  • 6
    Same as @Cory Grimster - I shut the services window and the pending delete was completed. Should have checked SO first ;-) – Paul Kohler Oct 13 '11 at 05:25
  • 21
    ProcessExplorer seems to cause this also (I was caught out when procexp was running in the system tray) – Rich Sep 11 '12 at 14:30
  • 2
    Omg, you guys are life savers. I had the process explorer AND the service control panel open. – Chev Aug 22 '13 at 23:38
  • 1
    Closing "Service" window works. Windows is soooooo "Amazing"! – silencej Jun 12 '20 at 06:01
92

I had a similar problem and what I did to overcome it was the following:

  1. Stop the service: net stop "ServiceName"
  2. Ensure: the "mmc.exe" process does not exist (The "Services" list window): taskkill /F /IM mmc.exe
  3. Delete the service: sc delete "ServiceName"

    C:\server>sc delete "ServiceName"
    
    [SC] DeleteService SUCCESS
    

Now, if I execute another sc command, what I get is the following:

C:\server>sc delete "ServiceName"

[SC] OpenService FAILED 1060:

The specified service does not exist as an installed service.

But not the 1072 error message

Pacerier
  • 76,400
  • 86
  • 326
  • 602
Tate
  • 1,276
  • 11
  • 13
  • 2
    What has MMC have to do with this and why does it hold onto the service? – Fandango68 Apr 24 '18 at 06:25
  • In my case, for some reason, the service was not being presented in the services manager and I didn't know it was still running. So the "net stop" did the trick for me. – Daniel Lobo May 03 '19 at 10:59
26

What I've done is go to this location in regedit:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

From here, you will see a folder for every service on your machine. Simply delete the folder for the service you wish, and you're done.

N.B: Stop the service before you try this.

iCodeSometime
  • 1,230
  • 12
  • 28
Onion-Knight
  • 3,257
  • 7
  • 29
  • 34
  • Re "*you will see a folder for every service on your machine*"; How did you know this? Any [citations](http://xkcd.com/285)? – Pacerier Apr 11 '16 at 17:55
  • I was able to delete the folder when the service is stuck at stopping. – Gellie Ann Apr 30 '18 at 01:01
  • After deleting the folder for Tomcat9 in Services as well as HKLM/software, that service name was successfully removed from the services.msc list of services. that made new tomcat service installation possible – rinilnath Sep 16 '20 at 06:20
10

For some buggy reason both Event Viewer and/or Services.msc won't do a proper refresh when you tell them to!

Close them and restart, and the service would have been deleted anyway.

Fandango68
  • 3,464
  • 2
  • 32
  • 54
8

I had the same issue. After I closing and re-opening the Computer Management window the service was removed from the list. I'm running windows 7

Rob
  • 166
  • 1
  • 4
3

In Windows 7, make sure Event Viewer closed before deleting.

lsalamon
  • 7,574
  • 5
  • 46
  • 60
1

I had this error also, make sure the exe the service is pointing to is stopped. Also make sure you don't have any Windows dialog boxes behind your other windows. That is why mine wasn't deleting. There was a windows message behind it saying this service has been deleted or something similar.. just had to click ok, there it went.

germs
  • 11
  • 1
1

I had the same error due to a typo in the service name, i was trying to delete the service display name instead of the service name. Once I used the right service name it worked fine

Rahamat
  • 11
  • 1
1

Logging-out and logging-in again close all blocking apps thus resolves the problem.

vahapt
  • 1,565
  • 1
  • 19
  • 24
1

The 3rd party application uninstaller had removed the files for the service and then left the service in this pending deletion state.

After trying to close all applications, identifing PID of service(couldn't) for kill, logging off all other users and logging off and on, rebooting was the only fix that worked for me.

rob
  • 7,218
  • 8
  • 50
  • 64