Skip to content

Instantly share code, notes, and snippets.

@sathed
Last active September 6, 2018 19:19
Show Gist options
  • Save sathed/359c10bed262cfb2f227786f5d6ea255 to your computer and use it in GitHub Desktop.
Save sathed/359c10bed262cfb2f227786f5d6ea255 to your computer and use it in GitHub Desktop.
Get the state of a Windows process.
#Using Notepad as an example.
$target = "notepad"
#Get the process
$process = Get-Process -Name $target -ErrorAction SilentlyContinue
#Get the execution state of the thread.
$threads=$process.Threads
$threads | select Id,ThreadState,WaitReason
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment