Powershell Set-Content seems to corrupt my SSIS .dtsx files



I have build a simple powershell script which replaces the xml path configuration in dtsx files using get-content / set-content.



(Get-Content $file.PSPath) | ForEach-Object {$_ -replace $searchtext , $replacetext} | Set-Content $file.PSPath


When i use it and try to run the package from sql server agent job i get an error saying:



"Unable to load the package as XML because of package does not have a valid XML format."


If i edit the file myself with sublime and not use the script it is ok.


The replace is happening ok, i used kdiff to compare the files and there are no differences.


Any ideas?


No comments:

Post a Comment