Powershell‎ > ‎

Processes

 Get Parent Process

http://groups.google.com/group/microsoft.public.windows.powershell/browse_thread/thread/eb0ac5dfa6015c38

#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





Comments