I am trying to figure out a way to update my web.config for different environments by updating the configSource for the appSettings element in the web.config.
Here
Finally figured it out.
$root = $xml.get_DocumentElement().SelectSingleNode("//client[@configSource]").configSource = "test"
of course, I will replace "//client[@configSource]" with a variable so I can pass in different nodes as parameters to create my base script.
Im looking for a way to modify the code as well.
Here is a way you can view whats the node:
$path = 'c:\site\web.config'
$PublishState = (Select-Xml -Path $path -XPath "configuration/appSettings/add[@key='PublishState']/@value").Node.'#text'
$PublishState