Processes
Get Parent Process
Get Parent Process
#Through WMI's Win32_Process' ParentProcessID property:
gwmi win32_process |ft Name, ProcessID, ParentProcessID -a
gwmi win32_process |? {$_.ParentProcessID} |ft Name,ParentProcessID -a
gwmi win32_process |? {!$_.ParentProcessID} |ft Name,ParentProcessID -a
# aliases used:
# gwmi = Get-WmiObject
# ? = Where-Object
# ! = -not (operator)
# ft = Format-Table
Get-process with user info.
http://myitforum.com/cs2/blogs/scassells/archive/2008/05/20/powershell-get-a-process-owner.aspx
(Get-WmiObject -Class win32_process | where{$_.ProcessName -eq 'AutoHotkey.exe'}).getowner() | select domain, user