Hello, I am new to powershell just watched the jumpstart videos two days ago. Being a former Linux admin/dev I really like powershell and I am very excited to get involved with the community.
Here is the problem I am trying to solve. I am creating a script to promote a web page from DEV to UAT and then Production if all goes well. So the first thing I am really trying to do is change the web.config file to set debug = false/true depending on some logic I will define. Then I want to change the SQL DB connection string to point to the target environment. The debug value works great.
The problem I am having is with the connection string.
CODE:
$webConfig = "C:\users\%user%\desktop\gsrs\web\web.config" $doc = new-object System.Xml.XmlDocument $doc.Load($webConfig) $doc.get_DocumentElement()."system.web".compilation.debug = "true" $doc.Save($webConfig) $doc.get_documentelement().configuration.connectionstring = "test"
ERROR:
The property ‘connectionstring’ cannot be found on this object. Verify that the property exists and can be set.
At line:6 char:1
- $doc.get_documentelement().configuration.connectionstring = “test”
-
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : PropertyNotFound
I have tried with a configuration.connectionstring.add
.name
and a few other variations.
I know this is something small and I am just missing it. Your help is greatly appreciated.
Thank you in advance…
Mike