Get-Process differs from Task Manager in memory usage


hello everyone,

this not first post topic haven't found single post explains it: if call get-process, information memory usage. of them different task manager. still ask myself (after searching around) why case , can values task manager in powershell.

isn't there simple solution how , why have difference? mean there must source task manager gets information...

thanks!
regards
christian


task manager gets information performance counter, not directly available information returned get-process.  can information powershell, though.  example uses get-counter cmdlet, new powershell 4.0 (though can use underlying .net classes accomplish similar in older versions of powershell, if needed.)

get-process | foreach-object {     $proc = $_     $counter = get-counter -counter "\process($($proc.name))\working set - private"      $pws = 'unknown'     if ($null -ne $counter)     {         $pws = $counter.countersamples[0].cookedvalue     }      $proc | add-member -notepropertyname 'privateworkingsetsize' -notepropertyvalue $pws -passthru } | format-table processname,id,privateworkingsetsize

keep in mind fetching performance counter data isn't particularly fast; take little while finish running if every process on system, did in example.


Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Group Policy Event ID 1058 Error Code 1326 (The user name or password is incorrect)

Suspicious event log Event ID: 4905

DCOM received error "2147746132" from...