Wednesday, December 27, 2017

Update Web.Config file using Power Shell

Recently in experts exchange forum some one asked how to update the web.config using Power Shell

Here is the code which you can use to update the web.config, change the filter as per your requirement

$files = Get-ChildItem -Path "D:\WebConfig" -Filter "*.config"

foreach($file in $files)
    $configFile = $file.FullName
    $appConfig = [xml](Get-Content $configFile)
    $appConfig.configuration.ChildNodes | Where-Object Name -Match 'system.web' | ForEach-Object {


No comments:

Post a Comment

Popular Posts