Please Help out With Powershell Script for :
- Delete Specific “ ” node in Config-B.xml
- Read specific “” node from Confi-A.xml.
- Append in config-B.xml with step 2 out value.
Config-A.xml
Config-B.xml
#################### Get Source XML Node Value ########################## $CustomWinClientConfigXmlSource = "SourcePath\Config.xml" [xml]$SourceConfigXml = Get-Content -Path "$CustomWinClientConfigXmlSource" -Raw $SourceXmlNode = $SourceConfigXml | Select-Xml -XPath "//Section[@Name='APILibraries']" $SourceXmlOutput = Write-Output "$SourceXmlNode" $SourceXMLNodeValue = "$SourceXmlOutput" #################### Get The Target XML Node Value And Delete It ############## $WinClientConfigFiles = "Config.xml" $CustomWinClientConfigXmlTarget = "TargetPath\$WinClientConfigFiles" $Path = "$CustomWinClientConfigXmlTarget" [Xml]$servicefactoryconfig = Get-Content -Path $Path -Raw $old = $servicefactoryconfig.SelectSingleNode("/Configuration/Data/Section[@Name='APILibraries']") $parent = $old.ParentNode [void] $parent.RemoveChild($old) ################################# Append The Target XML With Source XML Node Value ########### Try { $newNode = [Xml] @" $SourceXMLNodeValue "@ } Catch { Write-Error -Message 'Ignoring The Error Message' -ErrorAction Ignore } [void] $parent.AppendChild($servicefactoryconfig.ImportNode($newNode.DocumentElement,$true)) $servicefactoryconfig.save($path)