PowerShell_Scripts/Stop-ProcessTree.ps1
lksz 310103c2f7 A lot of new stuff
Docker and Docker-Compose commands and aliases:
- dco: docker-compose
- dcc: docker-compose config
- dcedit/vidc/Edit-DockerCompose:
    edit docker-compose.yml and satellite files
- dcdown.ps1
- dl/dll/dcl/dcll:
    view docker/docker-compose logs
    l : follow
    ll : just list
- dx/dcx: docker / docker-compose exec
- dcdown: docker-compose down
- dcup: docker-compose up
- dcr: docker-compose run
- dcre: docker-compose restart
- dcreup: docker-compose up with force recreate
- di: docker inspect

A bunch of other aliases and tools:
- l/ll - shortcuts for ls -la
- Edit-MyConfig with MyConfig.class: Edit various configuration files
- Update-ArchOSz: my common update params for Arch all ready to run
- Update-UbuntuOSz: my common update params for Ubuntu all ready to run
- sz-df - a ps stylized df
- sz-du - what's the size of a dir
- sys.Linux/ls - a Linux specific ls (with all required configuration)

Works in progress (not completely tested yet):
- Stop-ProcessTree
- Update-OSz.ps1
- src/smartsudo.inc.ps1
2020-10-31 17:10:32 -04:00

13 lines
670 B
PowerShell

[cmdletbinding()]param([string]$ProcessName)
$local:new_KillPIDs = @() + (Get-Process -name $processName | Select-Object -ExpandProperty ID)
$local:KillPIDs = @()
Do {
$KillPIDs += $new_KillPIDs | Where-Object { $_ -notin $KillPIDs }
Write-Verbose "Again"
Write-Verbose $new_KillPIDs -join ", "
$new_KillPIDs = $new_KillPIDs | ForEach-Object { Get-CimInstance -ClassName Win32_Process -Filter "ParentProcessId = $_" } | Select-Object -ExpandProperty ProcessId
} Until ( -not $new_KillPIDs )
Write-Verbose "Done"
start-process powershell -ArgumentList "-command","Stop-Process -Force -Id @($($KillPIDs -join '', ''))" -WindowStyle Minimized