How can you use PowerShell's . (dot) notation to walk through elements with periods in the element name? How can you use PowerShell's . (dot) notation to walk through elements with periods in the element name? powershell powershell

How can you use PowerShell's . (dot) notation to walk through elements with periods in the element name?


$webAppXml.configuration.'system.web'


This works too:

e.g.

$webAppXml.configuration.["system.web"].Identity


Alternatively, you can use variables:

$subproperty = 'System.Web'$webAppXml.configuration.$subproperty

I find this to be the most useful technique, because it lets me switch properties easily.

BTW, you can use the same trick to get to a method definition, and not run it.

Hope this Helps