I am having a xml file similar to below.
<Parameters>
<Parameter IsEncrypted="False">
<ParameterName>pRdGpInstallOptions</ParameterName>
<ParameterValue>Custom</ParameterValue>
</Parameter>
<Parameter IsEncrypted="False">
<ParameterName>pRdAccept</ParameterName>
<ParameterValue>true</ParameterValue>
</Parameter>
<Parameter IsEncrypted="False">
<ParameterName>pCboEditSQLServer</ParameterName>
<ParameterValue>MachineName\SQLEXPRESS</ParameterValue>
</Parameter>
</Parameters>
I have copied only few nodes here. Actually the real file may be having hundreds of Parameter nodes.
We can’t hard code the index as it may appear in any order. I am trying to retrieve SQLinstance name parameter value which is associated with Parameter Name "pCboEditSQLServer".
I would like to retrieve this value using powershell. How to parse this dynamic xml files?
Here’s another option (should be faster) using xpath:
And there’s the
Select-Xmlcmdlet: