ersin.fr
msgbartop
just my personal notebook…
msgbarbottom


03 Aug 16 Listing IIS Application Pool Memory usage in PowerShell

Advertisements

Open Powershell as an Administrator on the web server, then run:

$apmem= gwmi -ComputerName localhost -NS 'root\WebAdministration' -class 'WorkerProcess' | select PSComputerName, AppPoolName,ProcessId , @{n='RAM';e={ [math]::round((Get-Process -Id $_.ProcessId -ComputerName $_.PSComputerName).WorkingSet / 1Mb) }} | sort RAM -Descending | ft -AutoSize

echo $apmem

You should see something like:

PS C:\Windows\system32> C:\scripts\appool.ps1

PSComputerName AppPoolName ProcessId RAM
-------------- ----------- --------- ---
MYSERVER01 ersinakyuz.com 2352 1150
MYSERVER01 kutuphaneleriseviyorum.org 6184 729
MYSERVER01 perlmonks.com 3444 646

If you get Get-WmiObject : Could not get objects from namespace root/WebAdministration. Invalid namespace then you need to enable the IIS Management Scripts and Tools feature using:

ipmo ServerManager
Add-WindowsFeature Web-Scripting-Tools