{"id":14022,"date":"2020-02-05T18:25:47","date_gmt":"2020-02-05T18:25:47","guid":{"rendered":"http:\/\/shivaprogramming.com\/blog\/?p=14022"},"modified":"2022-01-06T12:58:18","modified_gmt":"2022-01-06T12:58:18","slug":"modiyfy-webconfig-connectionstring-using-powershell","status":"publish","type":"post","link":"http:\/\/shivaprogramming.com\/blog\/modiyfy-webconfig-connectionstring-using-powershell\/","title":{"rendered":"Modify webconfig connectionstring using powershell"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>\n &#91;CmdletBinding()]\n  param ($PT_connectionstring_new =  \"newpassword\")  \n  $webConfig = 'D:\\Web.config'\n\nFunction updateWebConfig($config) \n{ \n$doc = (Get-Content $config) -as &#91;Xml]\n$root = $doc.get_DocumentElement();\n$activeConnection = $root.connectionStrings.SelectNodes(\"add\")|?{$_.name -eq \"PROD\"};\n$activeConnection.SetAttribute(\"connectionString\",$PT_connectionstring_new);\n$doc.Save($config)\n} \n\nupdateWebConfig($webConfig)\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[34,37,35],"class_list":["post-14022","post","type-post","status-publish","format-standard","hentry","category-powershell","tag-powershell","tag-valuechange","tag-webconfig"],"_links":{"self":[{"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/posts\/14022","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/comments?post=14022"}],"version-history":[{"count":3,"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/posts\/14022\/revisions"}],"predecessor-version":[{"id":15020,"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/posts\/14022\/revisions\/15020"}],"wp:attachment":[{"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/media?parent=14022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/categories?post=14022"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/tags?post=14022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}