One of the really cool things about Powershell is the ease with which you can read in XML and use Dot Notation “.” to get to elements.  For those of us whose XPath-Fu is weak this is awesome!

I have been using this to walk web.config files recently and I ran into an issue.  Let’s look at a sample web.config file…

In this case I am loading every web.config on a server to validate that it is not storing credentials.  To accomplish this I use the following code

 This gets me each web.config file for every Site and Application in each site.  Works like a champ.  Now I want to look at the authentication element inside of the system.web element.  Using the Dot Notation the code would look like:

 The problem, obviously is that it thinks that the system.web element is two elements, a system element and a web element inside of it.

Lucky for us there is a quick workaround using the Dot Notation…put the element in double quotes (“).  Thus the proper way to read an element with a period in the element name would be

 And there you have it.  A quick easy way to use Dot Notation with an element that contains a period.