how to kill hung services


have you been wondering to see when we stop the service manually using services.msc it takes forever?
according to m$ it said because the automatic service started before lanmanserver.
you can check this in the even viewer if it is showing these error:

Event ID: 7022
Source: Service Control Manager
Type: Error
Description: Server service hung on startup.

Event ID: 26
Source: Application Popup
Type: Information
Description: Application popup: Service Control Manager: At least one service or driver failed during system startup.

Event ID: 7001
Source: Service Control Manager
Type: Error
Description: The Computer Browser service depends on the Server service which failed to start because of the following error: After starting, the service hung in a start-pending state.

Event ID: 7001
Source: Service Control Manager
Type: Error
Description: The Distributed File System service depends on the Server service which failed to start because of the following error: After starting, the service hung in a start-pending state.

in my case it only shown 7001 and 7022 event ID.

so if this is the case you just edit or add a registry value:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Spooler

  1. Click Add Value on the Edit menu.
  2. Type DependOnService in the Value Name box.
  3. Click REG_MULTI_SZ in the Data Type box, and then click OK.
  4. Type LanmanServer in the Data box, and then click OK.

==========
but if you don’t find that this is the case, then you can forcefully stop the service using its pid.
fist you must know the service name, either by opening/running the services.msc
then you can identify the pid of the service by opening command prompt:
sc [space] queryex [servicename]

or by command line wmic (wmi command line tool, this only available in xp pro and server OS):
wmic
[space] /output:c:\process.txt [space] process [space] get [space] caption,commandline,processid
and you can see the pid in process.txt file.

or simple yet, you can use sommand line tasklist, to list running processes and its pid.

now after you see the pid, now you can use the command taskkill to kill the service forcefully using /F switch.
taskkill [space] /pid [space] [pid number] /F

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s