I would recommend that you capture the Id also. That way you are comparing the same process from run to run. Relying on the process name isn't very reliable.
120> $sb = { gps | Select Name, Id, WorkingSet } 121> $then = &$sb .... 123> $now = &$sb 124> $ht=[ at ]{}; $then | %{$ht[$_.Id]=$_} 133> $now | ? {$ht[$_.Id] -and $ht[$_.id].WorkingSet -ne $_.WorkingSet} | Select Name, [ at ]{n='Diff';e={$_.WorkingSet - $ht[$_.id].WorkingSet}} | Sort Diff -desc | % { "WS diff for $($_.Name) is $($_.Diff/1KB) KB"} WS diff for ipoint is 1784 KB WS diff for itype is 140 KB WS diff for dwm is 56 KB WS diff for msfwsvc is 12 KB WS diff for svchost is 12 KB WS diff for sqlservr is 12 KB WS diff for WmiPrvSE is 12 KB WS diff for msnmsgr is 12 KB WS diff for csrss is 12 KB WS diff for AcroRd32 is 4 KB WS diff for svchost is 4 KB WS diff for explorer is -4 KB WS diff for SearchIndexer is -4 KB WS diff for Moe is -8 KB WS diff for lsass is -12 KB WS diff for svchost is -12 KB WS diff for winss is -12 KB WS diff for wlmail is -72 KB WS diff for powershell is -1956 KB
-- Keith
"rferrisx" <rferris[ at ]rmfdevelopment.com> wrote in message news:dc972cd9-cd81-4112-9cf5-f93d03af1201[ at ]q26g2000prq.googlegroups.com...
[Quoted Text] > In this I want to filter out "0 KB" (e.g Those apps whose WS has not > changed in the specified $args [time])...but I am thinking my > construct is not working with objects quite right. Any input is > appreciated. > > > $then = ps | %{$_ | Select Name, WorkingSet} > sleep $args[0] > $now = ps | %{$_ | Select Name, WorkingSet} > $count = $now.count > $difference = ( 0..$count | > %{"WS diff is" + " " + $Now[$_].Name + " " + ( ( $then > [$_].WorkingSet / 1KB ) - ( $Now[$_].WorkingSet / 1KB ) ) + " " + > "KB"} ) > $difference > > [output like:] > > .\WS_diff.ps1 1200 > .... > WS diff is explorer -12 KB > WS diff is GoogleToolbarNotifier 0 KB > WS diff is GoogleUpdate 0 KB > WS diff is GoogleUpdaterService 0 KB > WS diff is gpowershell 0 KB > ... > WS diff is powershell -16 KB
|