Advertisement
Guest User

Untitled

a guest
May 6th, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Find-ChildProcess {
  2.     param($ID=$PID)
  3.      
  4.     $CustomColumnID = @{
  5.     Name = 'Id'
  6.     Expression = { [Int[]]$_.ProcessID }
  7.     }
  8.  
  9.     $result = Get-WmiObject -Class Win32_Process -Filter "ParentProcessID=$ID" | Select-Object -Property ProcessName, $CustomColumnID, CommandLine
  10.  
  11.     $result
  12.     $result | Where-Object { $_.ID -ne $null } | ForEach-Object {
  13.         Find-ChildProcess -id $_.Id
  14.     }
  15. }
  16.  
  17. $procid=get-process salt-minion |select -expand id
  18.  
  19. Find-ChildProcess $procid | Stop-Process -Force
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement