View Child Elements in Powershell

So I am trying to learn how to set IIS App Pools in Powershell, and also continue my training with Powershell.

I found somewhere that you can set the following attributes for the App Pool like this.

$appPool = Get-Item –Path IIS:\AppPools\XYZ_App_Pool
$appPool.processModel.identityType = "ApplicationPoolIdentity"
$appPool.enable32BitAppOnWin64 = 1
$appPool | Set-Item

Open in new window


I know I can do this to get a list of available options to set
Get-ItemProperty IIS:\AppPools\XYZ_App_Pool | select *

Open in new window


Output:
name                        : XYZ_App_Pool
queueLength                 : 1000
autoStart                   : True
enable32BitAppOnWin64       : True
managedRuntimeVersion       : v4.0
managedRuntimeLoader        : webengine4.dll
enableConfigurationOverride : True
managedPipelineMode         : Integrated
CLRConfigFile               : 
passAnonymousToken          : True
startMode                   : OnDemand
state                       : Started
applicationPoolSid          : S-1-5-82-2597519935-249327966-1169975569-694392190-3399998278
processModel                : Microsoft.IIs.PowerShell.Framework.ConfigurationElement
recycling                   : Microsoft.IIs.PowerShell.Framework.ConfigurationElement
failure                     : Microsoft.IIs.PowerShell.Framework.ConfigurationElement
cpu                         : Microsoft.IIs.PowerShell.Framework.ConfigurationElement
environmentVariables        : Microsoft.IIs.PowerShell.Framework.ConfigurationElement
workerProcesses             : Microsoft.IIs.PowerShell.Framework.ConfigurationElement
ItemXPath                   : /system.applicationHost/applicationPools/add[@name='XYZ_App_Pool']
PSPath                      : WebAdministration::\\WIN-6F7PH4VL1FD\AppPools\XYZ_App_Pool
PSParentPath                : WebAdministration::\\WIN-6F7PH4VL1FD\AppPools
PSChildName                 : XYZ_App_Pool
PSProvider                  : WebAdministration
PSIsContainer               : True
PSDrive                     : IIS
Attributes                  : {name, queueLength, autoStart, enable32BitAppOnWin64...}
ChildElements               : {processModel, recycling, failure, cpu...}
ElementTagName              : add
Methods                     : {Start, Stop, Recycle}
Schema                      : Microsoft.IIs.PowerShell.Framework.ConfigurationElementSchema

Open in new window


However, I see in original script it setting a child elements for ProcessModel. $appPool.processModel.identityType = "ApplicationPoolIdentity" and I see in my list an item called ChildElements that shows {processModel, recyclying, failure, cpu…}

How do I see the full list for the ChildElements and how do I see the options for each of those Child Elements?
Ed WalshSenior Director of Applications and Cloud ServicesAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

oBdACommented:
Well, there's always the possibility to assign the properties to a variable, then look at the single properties using tab completion, or piping to Select-Object or Get-Member.
$p = Get-ItemProperty -Path IIS:\AppPools\XYZ_App_Pool
$p.processModel | select *
$p.processModel | gm
$p.<TabCompletion>

Open in new window

And here's a little script that'll show you the ChildElements, their types, and their values; save as Get-ChildElement.ps1 or Whatever.ps1.:
[CmdletBinding()]
Param(
	$Path = "IIS:\AppPools\XYZ_App_Pool"
)
	Function Get-ChildElementRecurse {
	[CmdletBinding()]
	Param(
		$ChildElement,
		[string]$Parent = ''
	)
		$depth = $Parent.Split('.', [StringSplitOptions]::RemoveEmptyEntries).Count
		$Parent = $Parent + '.' + $ChildElement.ElementTagName
		"$('    '*$depth)$($Parent)" | Write-Host -ForegroundColor Yellow
		$ChildElement.Attributes | ForEach-Object  {
			"$('    '*$depth)$($_.Name) <$($_.TypeName)>: $($_.Value)" | Write-Host -ForegroundColor White
		}
		$ChildElement.ChildElements | ForEach-Object  {
			Get-ChildElementRecurse $_ -Parent $Parent
		}
	}
Get-ItemProperty -Path $path | Select-Object -ExpandProperty ChildElements | ForEach-Object {Get-ChildElementRecurse $_}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
oBdACommented:
Question answered.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.