{"id":645,"date":"2016-08-03T17:38:49","date_gmt":"2016-08-03T14:38:49","guid":{"rendered":"http:\/\/ersinakyuz.com\/blog\/?p=645"},"modified":"2016-08-03T17:41:38","modified_gmt":"2016-08-03T14:41:38","slug":"645","status":"publish","type":"post","link":"https:\/\/www.ersinakyuz.com\/?p=645","title":{"rendered":"Listing IIS Application Pool Memory usage in PowerShell"},"content":{"rendered":"<p>Open Powershell as an Administrator on the web server, then run:<\/p>\n<pre class=\"lang-bsh prettyprint prettyprinted\">$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\r\n\r\necho $apmem<\/pre>\n<p>You should see something like:<\/p>\n<pre class=\"lang-bsh prettyprint prettyprinted\">PS C:\\Windows\\system32&gt; C:\\scripts\\appool.ps1\r\n\r\nPSComputerName AppPoolName ProcessId RAM\r\n-------------- ----------- --------- ---\r\nMYSERVER01 ersinakyuz.com 2352 1150\r\nMYSERVER01 kutuphaneleriseviyorum.org 6184 729\r\nMYSERVER01 perlmonks.com 3444 646\r\n\r\n<\/pre>\n<p>If you get <strong>Get-WmiObject : Could not get objects from namespace root\/WebAdministration. Invalid namespace<\/strong> then you need to enable the <strong>IIS Management Scripts and Tools<\/strong> feature using:<\/p>\n<pre class=\"\">ipmo ServerManager\r\nAdd-WindowsFeature Web-Scripting-Tools\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Open Powershell as an Administrator on the web server, then run: $apmem= gwmi -ComputerName localhost -NS &#8216;root\\WebAdministration&#8217; -class &#8216;WorkerProcess&#8217; | select PSComputerName, AppPoolName,ProcessId , @{n=&#8217;RAM&#8217;;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&gt; C:\\scripts\\appool.ps1 PSComputerName AppPoolName ProcessId RAM &#8212;&#8212;&#8212;&#8212;&#8211; &#8230; <a title=\"Listing IIS Application Pool Memory usage in PowerShell\" class=\"read-more\" href=\"https:\/\/www.ersinakyuz.com\/?p=645\" aria-label=\"Read more about Listing IIS Application Pool Memory usage in PowerShell\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,7],"tags":[],"class_list":["post-645","post","type-post","status-publish","format-standard","hentry","category-powershell","category-programming"],"_links":{"self":[{"href":"https:\/\/www.ersinakyuz.com\/index.php?rest_route=\/wp\/v2\/posts\/645","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ersinakyuz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ersinakyuz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ersinakyuz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ersinakyuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=645"}],"version-history":[{"count":4,"href":"https:\/\/www.ersinakyuz.com\/index.php?rest_route=\/wp\/v2\/posts\/645\/revisions"}],"predecessor-version":[{"id":649,"href":"https:\/\/www.ersinakyuz.com\/index.php?rest_route=\/wp\/v2\/posts\/645\/revisions\/649"}],"wp:attachment":[{"href":"https:\/\/www.ersinakyuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ersinakyuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ersinakyuz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}