title: XML Remove node if exist with SelectSingleNode
body: <p>I try to build up a powershell script that removes a node from my web.config file if the node exist.
  I have following xml structure</p>
  
  <pre><code>&lt;configuration&gt;
    &lt;configSections&gt;
      &lt;sectionGroup name="common"&gt;
        &lt;section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging, Version=2.1.2.0, Culture=neutral, PublicKeyToken=af08829b84f0328e" /&gt;
      &lt;/sectionGroup&gt;
  
    &lt;/configSections&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>And following code:</p>
  
  <pre><code>[xml]$xml = Get-Content $WebAppConfigPath
  
   $addSectionGroupNode = $xml.SelectSingleNode("//configuration/configSections/sectionGroup/add[@name='common']")
    if ($addSectionGroupNode -ne $null)
    {
      $SectionGroupNode.RemoveChild($addSectionGroupNode)
      Write-Host "REMOVED"
    }
  
    $xml.Save($WebAppConfigPath)
  </code></pre>
  
  <p>However, the node cannot be found and is not removed. 
  Can you please help me get the right command?</p>
  
  <p>Thank you</p>