Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Shows info about the current process, and it's parent, and it's parent...
$processId = $PID
do {
$thisProcess = Get-CimInstance -ClassName Win32_Process -Filter "ProcessId = $processId"
$thisProcess | Select-Object ProcessId,ParentProcessId,Name,CreationClassName,CreationDate,CommandLine
$processId = $thisProcess.ParentProcessId
} while ($null -ne $processId)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment