Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Find-ChildProcess {
- param($ID=$PID)
- $CustomColumnID = @{
- Name = 'Id'
- Expression = { [Int[]]$_.ProcessID }
- }
- $result = Get-WmiObject -Class Win32_Process -Filter "ParentProcessID=$ID" | Select-Object -Property ProcessName, $CustomColumnID, CommandLine
- $result
- $result | Where-Object { $_.ID -ne $null } | ForEach-Object {
- Find-ChildProcess -id $_.Id
- }
- }
- $procid=get-process salt-minion |select -expand id
- Find-ChildProcess $procid | Stop-Process -Force
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement