I am trying to get process name and process memory usage through a PowerShell command:
Get-Process | Group-Object -Property ProcessName |
Format-Table Name, @{n='Mem (KB)';e={
'{0:N0}' -f (($_.Group|Measure-Object WorkingSet -Sum).Sum / 1KB)
};a='right'} -AutoSize
But when I pipe it with ConvertTo-Json
the output is different which gets me details of ClassID, outOfBand, which is not the output I expect.
I want the output in exact same way (Name and Mem (KB)) as it displays on screen but in JSON format.