Hello I'm having problem trying to get the values of one node with certain name from XML.
For example:
<Smart>
<Settings>
<Service name="9003">
<Config imports="router">
<Section name="x">
<Parameter name="a" value="0" />
<Parameter name="b" value="1" />
<Parameter name="c" value="2" />
<Parameter name="d" value="3" />
<Parameter name="e" value="4" />
</Section>
</Config>
</Service>
<Service name="9004">
<Config imports="router">
<Section name="x">
<Parameter name="a" value="5" />
<Parameter name="b" value="6" />
<Parameter name="c" value="7" />
<Parameter name="d" value="8" />
<Parameter name="e" value="9" />
</Section>
</Config>
</Service>
</Settings>
</Smart>
I want to get the value '9' from the Parameter named as "e" from the Service "9004" and then export or print it using the Write-Host.
Any ideas? I was trying this but it is returning nothing to me.
# Read the XML file
Write-Host "OPENING XML FILE";
$path = "\\$computer\$FileName"
[xml] $xml = Get-Content $path
# Filter the XML
$SectionName = "x"
$Section = $xml.Smart.Settings.Config.Section| Where-Object {$_.name -eq $SectionName}
Write-Host $Section