Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

How to modify target value in web.config using powershell

$
0
0

Hi i am trying to change the values of "target" in web.config file using powershell but no luck. this is the script which i am using. It works fine to change the app setting values but not the target values

$webConfig = 'C:\Users\Desktop\xml\web.config'
$doc = (Get-Content $webConfig) -as [Xml]
$obj = $doc.configuration.targets | where {$_.filename -eq 'test.log.txt'}
$obj.value = 'C:\test_logs\test.log.txt-${shortdate}.log.txt'
$doc.Save($webConfig)


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>