Created
August 18, 2022 22:05
-
-
Save dg1an3/dc09203fb01930492c36e97103f534bf to your computer and use it in GitHub Desktop.
App config powershell helpers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([String]$key) | |
Get-ChildItem .\*.config -Recurse | | |
Where-Object { ([xml](Get-Content $_)).SelectSingleNode("//add[@key='$key']") } | | |
ForEach-Object { | |
$xml = [xml](Get-Content $_) | |
$xml.SelectSingleNode("//add[@key='$key']").Value | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([String]$key, [String]$value) | |
Get-ChildItem .\*.config -Recurse | | |
Where-Object { ([xml](Get-Content $_)).SelectSingleNode("//add[@key='$key']") } | | |
ForEach-Object { | |
$xml = [xml](Get-Content $_) | |
$xml.SelectSingleNode("//add[@key='$key']").Value = $value | |
$xml.Save($_) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$allConfig|%{$_.AppSettings.Settings.Add('Environment', 'Value')}