Author Posts

September 13, 2013 at 11:47 am


I'm missing something very simple but I can not figure out what exactly I'm doing wrong. I'm trying to get to child object of another object and it fails.
Namely workprocess object of Application pool.

Import-Module WebAdministration
$pools = gci IIS:\apppools

I WorkerProcesses[0] is actully $null even though there are workerprocesses collection for that pool

September 13, 2013 at 12:12 pm

I think what you probably need is this:


September 13, 2013 at 12:15 pm

+1 This works.
I don't understand the problem though. $pool has collection of WorkerProcesses so I shall be able to access WorkerProcesses[0]. Why it does not work?

September 13, 2013 at 2:35 pm

The workerProcesses property isn't a collection; it's an object of type Microsoft.IIs.PowerShell.Framework.ConfigurationElement. I just ran these commands to try to discover what was there:

$pool = Get-Item IIS:\AppPools\MSExchangeSyncAppPool

Get-Member -InputObject $pool.workerProcesses

# Here's where I saw the NoteProperty called Collection


# This came back as PSObject[], so I tried:


# and it worked.