Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
XML删除节点(如果存在)和SelectSingleNode_Xml_Powershell - Fatal编程技术网

XML删除节点(如果存在)和SelectSingleNode

XML删除节点(如果存在)和SelectSingleNode,xml,powershell,Xml,Powershell,我尝试构建一个powershell脚本,如果存在某个节点,该脚本将从我的web.config文件中删除该节点。 我有以下xml结构 <configuration> <configSections> <sectionGroup name="common"> <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging,

我尝试构建一个powershell脚本,如果存在某个节点,该脚本将从我的web.config文件中删除该节点。 我有以下xml结构

<configuration>
  <configSections>
    <sectionGroup name="common">
      <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging, Version=2.1.2.0, Culture=neutral, PublicKeyToken=af08829b84f0328e" />
    </sectionGroup>

  </configSections>
</configuration>
但是,找不到该节点,因此未删除该节点。 你能帮我得到正确的命令吗

多谢各位

在其他的标准中,我们正在寻找一个元素,而这个元素并不存在

你是想用

/configuration/configSections/sectionGroup[@name='common']
?

注意,与XML文档的根元素一样,在表达式开头使用//只能减慢速度。

如何定义$SectionGroupNode?
//configuration/configSections/sectionGroup/add[@name='common']
/configuration/configSections/sectionGroup[@name='common']