stop a stop_pending service

Dave

Distinguished
Jun 25, 2003
2,727
0
20,780
Archived from groups: microsoft.public.windowsxp.basics,microsoft.public.windowsxp.general,microsoft.public.windowsxp.work_remotely (More info?)

Hi

How can I stop a "stop_pending" service.
I'm in the middle of a migration of a client for antivirus (MCAfee frameworkService)
I need to stop the service first before I can upgrade it but I have a problem on some stations
when I tru to stop the service it hangs on the status "STOP_PENDING"
How can I force this service to stop if it returns the "STOP_PENDING" state?

NOTE:
some of the stations are unreachable I have to do this remotely
(currently I'm using the SC command and Remote Task Manager to do this remotely)
I even tried stopping the proces with PSkill without succes.

thx in advance
 
Archived from groups: microsoft.public.windowsxp.basics,microsoft.public.windowsxp.general,microsoft.public.windowsxp.work_remotely (More info?)

Dave,

1. Use MMC > Add/Remove Snap-In > Services, Connect to the remote computer.
2. Select the service and set the startup type to "Disabled."
3. From command line, shutdown -m \\computername -r (- r for restart)

The PC should then reboot without starting that service.

HTH,

Eugenio

"Dave" wrote:

> Hi
>
> How can I stop a "stop_pending" service.
> I'm in the middle of a migration of a client for antivirus (MCAfee frameworkService)
> I need to stop the service first before I can upgrade it but I have a problem on some stations
> when I tru to stop the service it hangs on the status "STOP_PENDING"
> How can I force this service to stop if it returns the "STOP_PENDING" state?
>
> NOTE:
> some of the stations are unreachable I have to do this remotely
> (currently I'm using the SC command and Remote Task Manager to do this remotely)
> I even tried stopping the proces with PSkill without succes.
>
> thx in advance
>
>
 
Archived from groups: microsoft.public.windowsxp.basics,microsoft.public.windowsxp.general,microsoft.public.windowsxp.work_remotely (More info?)

In other words.

You can't.

Matt Gibson - GSEC

"eugenefl" <eugenefl@discussions.microsoft.com> wrote in message
news:6F7517CD-DB2A-4B35-8F9E-924C94ED180B@microsoft.com...
> Dave,
>
> 1. Use MMC > Add/Remove Snap-In > Services, Connect to the remote
> computer.
> 2. Select the service and set the startup type to "Disabled."
> 3. From command line, shutdown -m \\computername -r (- r for restart)
>
> The PC should then reboot without starting that service.
>
> HTH,
>
> Eugenio
>
> "Dave" wrote:
>
>> Hi
>>
>> How can I stop a "stop_pending" service.
>> I'm in the middle of a migration of a client for antivirus (MCAfee
>> frameworkService)
>> I need to stop the service first before I can upgrade it but I have a
>> problem on some stations
>> when I tru to stop the service it hangs on the status "STOP_PENDING"
>> How can I force this service to stop if it returns the "STOP_PENDING"
>> state?
>>
>> NOTE:
>> some of the stations are unreachable I have to do this remotely
>> (currently I'm using the SC command and Remote Task Manager to do this
>> remotely)
>> I even tried stopping the proces with PSkill without succes.
>>
>> thx in advance
>>
>>
 
Archived from groups: microsoft.public.windowsxp.basics,microsoft.public.windowsxp.general,microsoft.public.windowsxp.work_remotely (More info?)

Thx for the help guys

I was afraid for this solution
But if there is no other alternative.. I have to use to the restart routine.





On Thu, 24 Mar 2005 10:50:56 -0800, "Matt Gibson" <mattg@blueedgetech.ca> wrote:

>In other words.
>
>You can't.
>
>Matt Gibson - GSEC
>
>"eugenefl" <eugenefl@discussions.microsoft.com> wrote in message
>news:6F7517CD-DB2A-4B35-8F9E-924C94ED180B@microsoft.com...
>> Dave,
>>
>> 1. Use MMC > Add/Remove Snap-In > Services, Connect to the remote
>> computer.
>> 2. Select the service and set the startup type to "Disabled."
>> 3. From command line, shutdown -m \\computername -r (- r for restart)
>>
>> The PC should then reboot without starting that service.
>>
>> HTH,
>>
>> Eugenio
>>
>> "Dave" wrote:
>>
>>> Hi
>>>
>>> How can I stop a "stop_pending" service.
>>> I'm in the middle of a migration of a client for antivirus (MCAfee
>>> frameworkService)
>>> I need to stop the service first before I can upgrade it but I have a
>>> problem on some stations
>>> when I tru to stop the service it hangs on the status "STOP_PENDING"
>>> How can I force this service to stop if it returns the "STOP_PENDING"
>>> state?
>>>
>>> NOTE:
>>> some of the stations are unreachable I have to do this remotely
>>> (currently I'm using the SC command and Remote Task Manager to do this
>>> remotely)
>>> I even tried stopping the proces with PSkill without succes.
>>>
>>> thx in advance
>>>
>>>
>
 
If the service is an executable file then you can force it with the following command:

taskkill /s <hostname> /IM <exename> /F

Example:

taskkill /s myserver /IM notepad.exe /F

Hope that helps!
 
Thank you very much, it works perfectly!
I just want to add a little bit of explanation for others with the same problem.

You can retrieve the PID for the process of the service through the command

sc queryex <servicename>

it returns some information like this

NOME_SERVIZIO: <servicename>
TIPO : 10 WIN32_OWN_PROCESS
STATO : 3 STOP_PENDING
(STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN)
CODICE_USCITA_WIN32 : 0 (0x0)
CODICE_USCITA_SERVIZIO : 0 (0x0)
PUNTO_ARRESTO : 0x0
INDICAZIONE_ATTESA : 0x0
PID : 1824
FLAG :

Then you can stop the service by the command

taskkill /F /PID 1824 (the specific PID)


Hope this can be useful!
 
The taskkill is definitely useful, but has one caveat:
~~ Some microsoft services share a single instance of a single process (typically svchost.exe). Good examples of this are "Automatic Updates" and "Task Scheduler" ~~

One very useful way to tell what services belong to a particular process is with Process Explorer by Sysinternals (now owned by microsoft)

Process explorer
http://technet.microsoft.com/en-us/sysinternals/bb896653

Sysinternals utilities index
http://technet.microsoft.com/en-us/sysinternals/bb545027


and to reiterate, if you know the service runs in it's own process (most third party applications do) you can do this:
sc queryex <servicename>
taskkill /F /PID <pid>


~ Xpyder