I am new to powershell and have a requirement to extract oldVersion and newVersion value from web.config file under assembly bindings where assemblyIdentity name="identitiy1", not sure how to do it, any help would be highly appreciated, below is the sample from the config file.
I tried to get the appsetting keys something like this Select-Xml -Path filePath -XPath '/configuration/appSettings/add' | ForEach-Object { $_.Node.key} and that works but note sure how to read it from assemblyBinding.
<configuration>
<appSettings file="filepath">
<add key="key1" value="value1"/>
<add key="key2" value="value2" />
<add key="key3" value="value3" />
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="xxxx" publicKeyToken="xxx" culture="xx" />
<bindingRedirect oldVersion="xxx-yyy" newVersion="yyy" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="identitiy1" publicKeyToken="xxx" culture="xxx" />
<bindingRedirect oldVersion="1.0.0-5.0.0" newVersion="5.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="xxx" publicKeyToken="xxx" culture="xxx" />
<bindingRedirect oldVersion="xxx-yyy" newVersion="yyy" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>