19 lines
820 B
PowerShell
19 lines
820 B
PowerShell
# Find who locks old agent release dirs
|
|
$ErrorActionPreference = 'Continue'
|
|
Write-Output '=== processes mentioning releases ==='
|
|
Get-CimInstance Win32_Process | ForEach-Object {
|
|
$cl = $_.CommandLine
|
|
if ($cl -and ($cl -like '*agent\\releases*' -or $cl -like '*agent/releases*' -or $cl -like '*wwwroot*agent*')) {
|
|
Write-Output ("pid=$($_.ProcessId) name=$($_.Name)")
|
|
Write-Output (" " + $cl.Substring(0, [Math]::Min(300, $cl.Length)))
|
|
}
|
|
}
|
|
Write-Output '=== netstat 8910 owner tree ==='
|
|
$p = (Get-NetTCPConnection -LocalPort 8910 -State Listen -EA SilentlyContinue | Select-Object -First 1).OwningProcess
|
|
if ($p) {
|
|
$proc = Get-CimInstance Win32_Process -Filter "ProcessId=$p"
|
|
Write-Output ("listen_pid=$p parent=$($proc.ParentProcessId)")
|
|
Write-Output ($proc.CommandLine)
|
|
}
|
|
Write-Output 'LOCKERS_DONE'
|