I am trying to write a script that would provide me list of users who are consuming memory above threshold for an application process running on remote windows 2008 servers.
Output should be in below Format
Server_Name UserName
MemoryConsumed
Please note that there could be more than one instances for a user with that process.
I tried using below commands, but still not getting the data as required.
Using get process, I was able to get all the processes on remote host consuming memory above threshold:
get-process -ComputerName $vm.name [ProcessName] | Where-Object {$_.WorkingSet -gt 2GB}
Using below command I was able to fetch data w.r.t. to each User.
Get-WmiObject Win32_Process -Filter "name='[ProcessName]'" | Select Name, @{Name="UserName";Expression={$_.GetOwner().User}} | Sort-Object UserName, Name
But I am unable to fetch the data in required format