I'm having a problem trying to remove some sub-elements from an XML file.
<Smart>
<Settings>
<Section name="x">
<Parameter name="a" value="true" />
<Parameter name="b" value="0" />
<Parameter name="c" value="13873" />
<Parameter name="d" value="true" />
<Parameter name="e" value="EAI" />
</Section>
<Section name="z">
<Parameter name="h" value="true" />
<Parameter name="i" value="0" />
<Parameter name="j" value="13873" />
<Parameter name="k" value="true" />
<Parameter name="l" value="EAI" />
</Section>
</Settings>
</Smart>
I want to remove the whole line "Parameter name="l" value="EAI""
Any ideas? I was trying this but it is returning nothing to me.
# Read the XML file
Write-Host "OPENING XML FILE";
LogWrite "OPENING XML FILE";
$path = "\\$computer\$FileName"
[xml] $xml = Get-Content $path
# Deleting node
$npSectionName = "x"
$xml.Smart.Settings.Section | Where-Object { $_.name -eq $npSectionName } | % {
#Remove node
$xml.Settings.RemoveChild($_)