Select XML nodes from a namespace using Powershell
<p>I have the following xml:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;userSettings&gt;
  &lt;setting name="TelephonyServerHost"&gt;
    &lt;value&gt;sipserver.domain.local&lt;/value&gt;
  &lt;/setting&gt;
  &lt;setting name="SipServerFqdn"&gt;
    &lt;value&gt;sipserver.domain.local&lt;/value&gt;
  &lt;/setting&gt;
  &lt;setting name="WebServicesHost"&gt;
    &lt;value&gt;websvc.domain.local&lt;/value&gt;
  &lt;/setting&gt;
  &lt;setting name="KMSettings"&gt;
    &lt;value&gt;
      &lt;KMIndexSettings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
        &lt;AutoIndexEnabled&gt;false&lt;/AutoIndexEnabled&gt;
     &lt;/KMIndexSettings&gt;
    &lt;/value&gt;
  &lt;/setting&gt;
&lt;/userSettings&gt;
</code></pre>

<p>I am able to retrieve the values of the setting elements using xpath but I cannot figure out the correct syntax for querying the AutoIndexEnabled element using the namespace.</p>

<p>This works as expected for reading the KMSettings or other nodes which do not have a namespace:</p>

<pre><code>$xml = New-Object -TypeName 'System.XML.XMLDocument'
$xml.Load($xmlFilePath)
$node = $xml.SelectSingleNode("//userSettings/setting[@name='KMSettings']")
</code></pre>

<p>But I can't figure out the syntax on how to query the AutoIndexEnabled element.</p>