Windows 7 Slideshow

  1. # sample provided by PowerShell MVP Dr. Tobias Weltner 
  2. # for great inhouse PowerShell trainings, contact me at tobias.weltner@email.de 
  3.  
  4. function Find-ChildProcess
  5.   param($ID=$PID
  6.  
  7.     $CustomColumnID = @{ 
  8.         Name = 'Id' 
  9.         Expression = { [Int[]]$_.ProcessID
  10.     
  11.  
  12.     $result = Get-WmiObject -Class Win32_Process -Filter "ParentProcessID=$ID"
  13.       Select-Object -Property ProcessName, $CustomColumnID, CommandLine 
  14.  
  15.     $result 
  16.     $result |  
  17.         Where-Object { $_.ID -ne $null } |  
  18.         ForEach-Object
  19.         Find-ChildProcess -id $_.Id 
  20.     
  21.  
  22. # launch processes from within your powershell 
  23. # then try 
  24. # Find-ChildProcess 
  25. # Find-ChildProcess | Stop-Process -whatif 
 
Loading...
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.