Notification

Icon
Error

PowerShell - Top 10 Memory Hogs - Custom Action to get the Current Top 10 Memory Hogs on a PC

Posted: Tuesday, February 18, 2020 9:05:31 PM(UTC)
ZippoManOnFire

ZippoManOnFire

Member Original PosterPosts: 2
1
Like
I needed a quick way to get the top 10 Memory Hogs on a PC. This Command will open up Powershell on your computer and show you the top 10 Memory Hogs on the Remote PC. It pauses at the end to keep the Window Open.

powershell.exe Invoke-Command -ComputerName {smartname} {Get-Process |Sort-Object -Descending WorkingSet |Select-Object -first 10 Name,ID,@{Name='WorkingSet';Expression={[math]::Round($_.WorkingSet/1KB,2)}} |FT Name,@{L='PID';E={$_.id}},@{L='Memory';E={$_.workingset}};Pause}
ZippoManOnFire
#1ZippoManOnFire Member Original PosterPosts: 2  
posted: 2/19/2020 9:54:07 PM(UTC)
If the Pause at the end gives you pause, I came up with an alternative using cmd.exe /K. I also added an Echo at the beginning so you can see which computer it is being run against.

Code:
cmd.exe /K powershell.exe "echo '{smartname}';Invoke-Command -ComputerName {smartname} {Get-Process |Sort-Object -Descending WorkingSet |Select-Object -first 10 Name,ID,@{Name='WorkingSet';Expression={[math]::Round($_.WorkingSet/1KB,2)}} |FT Name,@{L='PID';E={$_.id}},@{L='Memory';E={$_.workingset}}}"
iamBaphomet
#2iamBaphomet Member Posts: 1  
posted: 2/21/2020 3:00:53 PM(UTC)
Thank you for this, much appreciated Applause

Active Discussions

Action Open Teams/SfB Chat with user
by  dshu   Go to last post Go to first unread
Last post: 6/25/2020 7:04:55 PM(UTC)
Action Find lost space the easy way (spacesniffer.exe)
by  krozar  
Go to last post Go to first unread
Last post: 5/5/2020 10:27:33 PM(UTC)
Lansweeper Querying a web server or web services
by  mmo   Go to last post Go to first unread
Last post: 5/5/2020 9:00:36 PM(UTC)
Action Password Status
by  brodiemac-too  
Go to last post Go to first unread
Last post: 4/23/2020 9:01:03 PM(UTC)
Action Email user
by  Michael Kop   Go to last post Go to first unread
Last post: 4/7/2020 11:24:12 AM(UTC)
Lansweeper actualizacion de datos importando csv
by  jhon freddy  
Go to last post Go to first unread
Last post: 3/31/2020 9:04:45 PM(UTC)
Lansweeper Asset Actions - RunAs Prompt
by  Socal_s197   Go to last post Go to first unread
Last post: 3/26/2020 10:02:16 PM(UTC)
Lansweeper Remote Registry 2019
by  CyberCitizen  
Go to last post Go to first unread
Last post: 3/6/2020 12:25:39 AM(UTC)