Reputation: 363
I am passing $SourceFileName as studentpackage.zip and copying the zip to below two location.how to update the xml attribute configsolutionfile when there is a change in $SourceFileName
function BuildArchive
{
param
(
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[String] $SourceFileName = ""
)
}
D:\StudentProgram\Automate\Publishing\Content\Forums\StudentPackage contains an xml file where I need to update the attribute configsolutionfile
<?xml?>
<config>
<solutions>
<configsolutionfile solutionpackagefilename="studentpackage.zip" />
</solutions>
</config>
D:\StudentProgram\Automate\Publishing\Content\Archives\StudentPackage contains an xml file where I need to update the attribute configsolutionfile
<?xml?>
<config>
<solutions>
<configsolutionfile solutionpackagefilename="studentpackage.zip" />
</solutions>
</config>
Upvotes: 0
Views: 113
Reputation: 466
You can do this:
[xml]$xml_contents = Get-Content 'path to XML'
$xml_contents.config.solutions.configsolutionfile.solutionpackagefilename = 'test'
$xml_contents.Save('Path to new XML')
Upvotes: 2