Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Need to have SysInternals handle/handle64.exe in the current working directory
- ## USE WITH EXTREME CAUTION - LIKELY TO CAUSE INSTABILITY
- [int]$counter = 0 ; if( ($process = Get-Process -name svservice) -and !($process -is [array])){ & .\handle64.exe -a -p $process.id -nobanner -accepteula | Where-Object { $_ -cmatch '\s?([A-F0-9]*):\s' -and ! [string]::IsNullOrEmpty( ( $handle = $Matches[1] ) ) } | ForEach-Object { & .\handle64.exe -c $handle -y -p $process.id -nobanner ; if($?){$counter++}}};"Handles closed $counter"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement