title: Foreach through XML document with Powershell returning multiple nodes
body: <p>Trying to gather server and environment information from an XML document. But, when I use the foreach loop to iterate through the document, it returns both nodes in the tree, instead of one at a time.</p>
  
  <pre><code>[xml]$xmlDoc = [xml](Get-Content("C:\temp\compareVHD_info.xml"))
  
  foreach($env in $xmlDoc.pvs.env)
  {
      if($env -eq "prod")
      { do stuff}
  }
  </code></pre>
  
  <p>XML:</p>
  
  <pre><code>&lt;pvs&gt;
    &lt;env&gt;
      &lt;prod&gt;
          &lt;primaryServer&gt;
              &lt;name&gt;name&lt;/name&gt;
              &lt;storePath&gt;path&lt;/storePath&gt;
          &lt;/primaryServer&gt;
          &lt;secondaryServer&gt;
              &lt;name&gt;name&lt;/name&gt;
              &lt;storePath&gt;path&lt;/storePath&gt;
          &lt;/secondaryServer&gt;
      &lt;/prod&gt;
      &lt;nonProd&gt;
          &lt;primaryServer&gt;
              &lt;name&gt;name&lt;/name&gt;
              &lt;storePath&gt;path&lt;/storePath&gt;
              &lt;storePath&gt;path&lt;/storePath&gt;
              &lt;storePath&gt;path&lt;/storePath&gt;
              &lt;storePath&gt;path&lt;/storePath&gt;
          &lt;/primaryServer&gt;
          &lt;secondaryServer&gt;
              &lt;name&gt;name&lt;/name&gt;
              &lt;storePath&gt;path&lt;/storePath&gt;
              &lt;storePath&gt;path&lt;/storePath&gt;
              &lt;storePath&gt;path&lt;/storePath&gt;
              &lt;storePath&gt;path&lt;/storePath&gt;
          &lt;/secondaryServer&gt;
      &lt;/nonProd&gt;
    &lt;/env&gt;
  &lt;/pvs&gt;
  </code></pre>
  
  <p>I'm trying to gather the primary and secondary server names, the storepaths, and the store paths. Though, when I use the code above, it returns both "prod nonProd" in the $env variable</p>
  
  <p>Thanks in advance for the help!</p>