I want an application or script that displays the following: Worker process, App pool name, memory usage, and optionally cpu usage. I am familiar with using
%windir%\system32\inetsrv\appcmd.exe list wp
but this just gets me the workerproces id and the app pool name. I then take that and cross reference taskmanager. This works, but I would like a quicker - almost dashboard like display of the information. I imagine there must be some sort of solution that shows the information without needing to click around like process explorer. Anyone have something in particular they use? Would this be possible in powershell?
If you don't have IIS 7 and the provider, you can use WMI. The attached script works for most of your requirements, except CPU usage. Save the below script as get-webserverapppoolstats.ps1 (or whatever you want).
You can run the script then with:
./Get-WebServerAppPoolStats.ps1 'Server1', 'Server2', 'Server3' -IntegratedAuthentication OR Get-Content servers.txt | ./Get-WebServerAppPoolStats.ps1 -IntegratedAuthentication
Yes powershell can do this with the new powershell provider for IIS it's easy. Here are some of the examples from the run time data walkthru's provided:
AppPool State
Worker Processes and Requests The get-process cmdlet doesn't help you figuring out which Application Pool a particular worker process is serving. This can be easily done however:
note that once you have the PID regular
will tell you the memory usage
I dont know why the Server 'name' part of this script didn't work for me, but i came up with a workaround:
replace this line:
$Server = @{Name='Server';Expression={$server}}
with these two lines:
$machine = New-Object system.string $server
$Server = @{Name='Server';Expression={$machine}}
once i did this, it worked perfectly.