0
노드가 존재하면 web.config 파일에서 노드를 제거하는 powershell 스크립트를 작성하려고합니다. 내가 코드를 다음과 같은 XML 구조를XML SelectSingleNode가있는 노드가 존재하면 제거하십시오.
<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>
다음과 같습니다
[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)
그러나, 노드를 찾을 수 없습니다 및 제거되지 않습니다. 올바른 명령을 내게 도와 주시겠습니까?
는<sectionGroup>
내부 즉시
<add>
요소를 찾고 다른 기준의 사이에 당신
'$ SectionGroupNode'는 어떻게 정의되어 있습니까? – Richard