≡ Menu

PowerShell: Find applications in “Not Responding” state in Task manager

A application can go unresponsive because of various reasons. Until, we identify and kill such applications, the system hands and creates log of inconvenience to the user. Such applications also consume resources and make system unstable. So, let us see how to identify the not responding applications in a computer.

When I say “Not Responding”, I mean to refer to the status that the applications shows in Task manager. Some applications look fine from task manager perspective but may not be doing their actual task. They are out of scope for this post.

Each process returned by Get-Process has a attributed called Responding which indicates the status of application. The value of this attribute is set to True if the application is running fine. A False value indicates that application is not responding.

Code:

[CmdletBinding()]            
Param(            
 [string[]]$ComputerName = $env:ComputerName            
)            

foreach($Computer in $ComputerName) {            
 if(!(Test-Connection -ComputerName $Computer -Count 1 -quiet)) {             
  Write-Host "$Computer : OFFLINE"            
  Continue            
 }            
 try {            
  $Processes = Get-Process -ComputerName $Computer -EA Stop            
  $nProcesses = @($Processes | ? { $_.Responding -eq $false })            
 } catch {            
  Write-Error "Failed to query processes. $_"            
 }            

 if($nProcesses) {            
  foreach($nProcess in $nProcesses) {            
   $nProcess | select Name, id, MainWindowTitle, Responding            
  }            

 } else {            
  Write-host "No non-responding processes found"            
 }            

}

This function will return name, PID, windows title of the non responding process. If you want to kill such processes, refer to the article I have written for 4SYSOps(http://4sysops.com/archives/query-and-kill-a-process-on-a-remote-computer-using-powershell-and-wmi/)

Comments on this entry are closed.

  • Dennis December 23, 2015, 2:31 pm

    According to the help on MSDN you should get a NotSupportedException error indictaing that:

    You are attempting to access the Responding property for a process that is running on a remote computer. This property is available only for processes that are running on the local computer.