instead of looking at the Task Manager and trying to find who is using the most, you can use this PowerShell script:
$h = @{}Notice that this gives you the actual RAM usage which might not be what you are looking for, as recent users probably using more RAM than not recent ones.
get-wmiobject win32_process | foreach {
$u = $_.getowner().user;
if ( $u -ne $null)
{
if ( !$h.ContainsKey($u) )
{
$h.add( $u, $_.WS);
}
else
{
$h.item($u) = $h.item($u) + $_.WS;
}
}
}
$h.GetEnumerator() | sort value -desc
If you want to know the total usage of Virtual Memory - replace "WS" with "VM".
4 comments:
My friend, can you tellme how to show the results yn MB or GB?
Thank you for that piece of code, it was exactly what I needed for my environment
I'm sending a new change to show the memory in MB:
$h = @{}
get-wmiobject win32_process | foreach {
$u = $_.getowner().user;
if ( $u -ne $null)
{
if ( !$h.ContainsKey($u) )
{
$h.add( $u, $_.WS);
}
else
{
$h.item($u) = $h.item($u) + $_.WS;
}
}
}
$h.GetEnumerator() | select-object name,@{name='MemoryUsage';expression={$_.value/1mB}}|sort name
Thanks a lot for writing this useful piece, I appreciate the effort and clarity in explanation. Read this article and gain more knowledge Jitter Click Test. Practicing the Jitter Click Test can enhance your clicking performance and reaction speed.
Post a Comment