
Untitled
By: a guest on
Aug 10th, 2012 | syntax:
None | size: 0.54 KB | hits: 10 | expires: Never
powershell weirdly encodes ampersands when I try to set the value to an xml attribute
function set-connectionstring {
param($path, $name, $value)
$settings = [xml](get-content $path)
$setting = $settings.configuration.connectionStrings.add | where { $_.name -eq $name }
$setting.connectionString = "$value"
$setting.providerName = "System.Data.SqlClient"
$resolvedPath = resolve-path($path)
$settings.save($resolvedPath)
}
[System.Reflection.Assembly]::LoadWithPartialName("System.web")
[System.Web.HttpUtility]::HtmlDecode(""")