kill windows service stuck at stopping

Every infracture admin need to know the steps to force stop or kill windows service stuck at stopping by pid using taskkill or powershell. Think about a situation, you are trying to stop a windows service but its stuck at stopping status. Means service stopping hung and not responding. In this case we need to force kill windows service either by using taskkill in command line (cmd) or by powershell. Follow the step by step commands to apply in cmd for force stop service windows server.

Run command prompt as an administrator and type taskkill help command as below. That will display parameter list like /S, /U, /P, /FI, /PID, /IM, /T, /F, /? and why these are used. You will find these parameters in the commands below.

Advertisements
Advertisements

kill windows service command line

taskkill /?
kill windows service using taskkill windows command line
kill windows service using taskkill windows command line
kill process id using taskkill windows command line
kill process id using taskkill windows command line

First step is to identify the “Service name” of windows service stuck at stopping. Let’s say windows update service stuck at stopping, then right click on the service and click on properties will show you the service name “wuauserv”. Alterenatively, you can run powershell command “Get-Service” to get windows service details. Run the below command in command prompt to get the PID of service.

sc queryex <service name>
sc queryex wuauserv
windows service properties service  name
windows service properties service name
sc queryex wuauserv
sc queryex wuauserv
Advertisements
Advertisements

You can check the PID in “Task manager” under the the tab “Services”.

PID in Task manager
PID in Task manager

Next step is to kill windows service PID running below cmd in command prompt.

taskkill /f /pid [PID]
taskkill /f /pid 996
taskkill /f /pid
taskkill /f /pid

You will find the service is stopped after applying the command above. You can disable the serivce else apply the state as per your requirement.

windows update service stopped how to disable
windows update service stopped how to disable
Advertisements
Advertisements

You can kill processes from command prompt without knowing the PID by running the below command.

taskkill /F /FI "SERVICES eq wuauserv"
taskkill /F /FI "SERVICES eq wuauserv"
taskkill /F /FI “SERVICES eq wuauserv”

You can force stop a service running with particular user id using below cmd.

taskkill /F /FI "USERNAME eq Deviprasad"

cmd to task kill all windows services not respnding running as below.

taskkill /F /FI "status eq not responding"

You can kill services consuming more then a limit of memory usage following the command below.

taskkill /FI "memusage gt value"
taskkill /FI "memusage gt 220600"
kill pid memusage gt
kill pid memusage gt
kill service memusage gt
kill service memusage gt
Advertisements
Advertisements

Run the cmd as below to get list of tasks running in server.

tasklist
tasklist
tasklist

we can run the below cmd to kill task running in the server.

taskkill /F /IM taskmgr.exe
taskkill /F /IM taskmgr.exe
taskkill /F /IM taskmgr.exe

End task using powershell

We can use below powershell commands to kill windows service.

Stop-Process -ID ProcessID - Force
Stop-Process -ID 6196 - Force
Stop-Process -Name ProcessName -Force
Stop-Process -Name iexplorer -Force
kill service or pid usinf powershell
kill service or pid usinf powershell

powershell command to force kill services not responding.

Get-WmiObject -Class win32_service | Where-Object {$_.state -eq 'stop pending'}

Watch the video to get details step by step for better understanding.

Advertisements


Categories: administration, SharePoint 2019, sharepoint services, Task, windows service, Work Process

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , ,