terminate the duplicated old process

I am trying to terminate duplicated old process so only the nevest one will stay.

So I tested this script on winword and it doesn’t work.

Can someone help me what I did wrong?

Get-WmiObject -Class Win32_PerfFormattedData_PerfProc_Process | Where-Object -FilterScript {$_.Name -like 'winword'} | Sort-Object -Property ElapsedTime | Select-Object -Skip 1 | foreach {Stop-Process $_.IDProcess}

submitted by /u/Blisk1
[link] [comments]

Leave a Reply