Trevor Sullivan's Tech Room

Minding the gap between administration and development

PowerShell: Prompt Function to Monitor Memory Usage

Posted by Trevor Sullivan on 2012/01/23


Have you ever wanted to monitor your memory utilization in a PowerShell instance, but may not want to continually issue commands to determine it? Introducing …… the PowerShell Prompt to monitor memory utilization!!

function prompt {
    "$('{0:n2}' -f ([double](Get-Process -Id $pid).WorkingSet/1MB)) MB> "
}

Here’s the result:

image

One Response to “PowerShell: Prompt Function to Monitor Memory Usage”

  1. […] Monitor Memory usage from your PowerShell prompt […]

Leave a reply to Episode 174 – Matt Graeber using PowerShell in Infosec « PowerScripting Podcast Cancel reply