Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 10th, 2012  |  syntax: None  |  size: 0.54 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. powershell weirdly encodes ampersands when I try to set the value to an xml attribute
  2. function set-connectionstring {
  3.   param($path, $name, $value)
  4.   $settings = [xml](get-content $path)
  5.   $setting = $settings.configuration.connectionStrings.add | where { $_.name -eq $name }
  6.   $setting.connectionString = "$value"
  7.   $setting.providerName = "System.Data.SqlClient"
  8.   $resolvedPath = resolve-path($path)
  9.   $settings.save($resolvedPath)
  10. }
  11.        
  12. [System.Reflection.Assembly]::LoadWithPartialName("System.web")
  13. [System.Web.HttpUtility]::HtmlDecode(""")