i want to modify my web config file using powershell . i stuck in somewhere . i want to update appsettings and also connectionsstring information at the same time when i cha
$webConfig = "C:\Inetpub\Wwwroot\application\web.config"
$doc = (gc $webConfig) -as [xml]
$doc.SelectSingleNode('//appSettings/add[@key="mykey1"]/@value').'#text' = 'true'
$doc.SelectSingleNode('//connectionStrings/add[@name="myname1"]/@connectionstring').'#text' = 'my_string'
$doc.Save($webConfig)
You can use XPath to select your nodes and set their value via the #text property PowerShell adds.
Note - your example xml has problems with casing and some typos. Here is what I tested with: