I got 2 XML files I'm reading a value from the first and need to replace that value in the second XML in a specific string, this is what I got so far and it doesn't work well it change the whole XML to #document for some reason
EDIT Reworking my whole logic for the script and I'm stuck with trimming the node, getting an error at IdexOf why?
<BunnyTemplate> <Parm Name="A-1" Source="Application" OnAbsence="1.com"> <Parm Name="A-2" Source="Application" OnAbsence="2.com"> <Parm Name="A-3" Source="Application" OnAbsence="\\3\3"/> <Parm Name="A-4" Source="Application" OnAbsence="4.com"> </BunnyTemplate>
$file1 = "C:\..\Desktop\file1.xml"
$file1Content = [xml](Get-Content $file1)
$targetNode = $file1Content.SelectSingleNode("//General/@findMe")
$trimmedNode = $targetNode.Substring(0, $targetNode.IndexOf('last'))
$file2$file1.BunnyTemplate.parm.OnAbsence = 'NewValue'