Wednesday, November 23, 2011

Using powershell to get IIS worker process

Preparation:
  • Enable execution of powershell scripts with command:
 Set-ExecutionPolicy RemoteSigned
  • Import module for IIS
  import-module webadministration


Now you should be able to see new drive (IIS)

  get-psdrive


Now, to see worker process for specific pool you only need to execute:


   dir 'IIS:\AppPools\myAppPoolName\WorkerProcesses'

To list all process IDs use:


   dir IIS:\AppPools | Get-ChildItem | Get-ChildItem | Format-Table -AutoSize  processId, appPoolName