To update the specific XML node using PowerShell, we first need to select that node with the attribute with SelectSingleNode() method.
We have below the XML file from the link stored in SampleXml.XML on C:\Temp location.
In this example, we are going to update Autor and Genre properties of the Book having attribute Id = ‘bk102’
The above commands will load the XML file and select node with attribute value ‘bk102’.
$node.genre='Non-Fiction' $node.author='Dell James' $xml.Save("C:\Temp\SampleXML.xml")
The above commands will update the genre and author property.