Code template:
1 2 3 4 5 6 7 8 | $path = '<path to xml file>' $xml = Get-Content ( $path ) $newNode = $xml .CreateElement( '<name of new element>' ) $newNode .SetAttribute( '<Attribute key>' , '<Attribute value>' ) $xml .ParentElement.AppendChild( $newNode ) $xml .Save( $path ) |
‘ParentElement’ is the name of the element which you want to add the new child to.
Always remember to save the file or it will not be updated.