I am trying to get all the suspended tasks from a terminal server running windows server 2012.
I have tried using powershell with wmi object like so:
Get-WmiObject -Class Win32_Process -ComputerName computername -Property status
But the status
property of all the processes is empty, yet it shows up in the details view of the task manager like so:
I have also tried the following code to try and get the status of the running threads:
$processes = Get-Process * -ComputerName ppivts | select name,threads
foreach ($process in $processes)
{
foreach ($thread in $process.Threads)
{
if($thread.ThreadState -ne "Wait"){
$process.Name
$thread.ThreadState
}
}
}
This does not work either. How do I get the status of the process and more specifically the suspended ones?