Find WorkingSet size with Powershell get-process

09 October,2013 by Jack Vamvas

Question : I want to report on the Physical Memory WorkingSet value of an executable  . I want to run a daily report on the WorkingSet of the process to identify any memory leaks . How can I obtain the current WorkingSet value over multiple servers?    Is the WorkingSet a useful value to monitor?

Answer: The Powershell get-process cmdlet   returns the information required. There are some examples below , which return various combimations, such as process name and greater than a certain value

 The working set is the set of pages of physical memory that a process is using. Only data stored in physical memory (not currently paged to disk) is in the working set.  It’s a useful method to identify Physical memory usage of a process.

For the SQL Server process – it’s not a good value to use if Locked Pages in memory is used. Click here for more details on why Task Manager not showing correct SQL Server memory usage

 

--return all processes with a working set of greater than 600000 KB 
get-process -computername myServer | where-object{$_.WorkingSet/1024 -gt 600000}

--return  process details of a specific process
get-process -computername myServer | where {$_.name -eq 'process1'}

--return only a certain set of columns for a specific process
get-process -computername myServer | where {$_.name -eq 'process1'} | select ProcessName,WS

--powershell script to iterate through multiple servers and return the working set value of a specific process
foreach ($svr in get-content "C:\powershell\servers.txt")
{
 get-process -computername $svr | where {$_.name -eq 'process1'} | Select MachineName,ProcessName, WS
   
}

Read More 

 Task Manager not showing correct SQL Server memory usage

Powershell Scripts

SQL Server – Troubleshooting Internal Memory pressure – stolen pages and buffer count


Author: Jack Vamvas (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Find WorkingSet size with Powershell get-process


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer