mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
33 lines
890 B
PowerShell
33 lines
890 B
PowerShell
function Write-IcingaforWindowsManagementConsoleConfigSwap()
|
|
{
|
|
param (
|
|
$Config = @{ }
|
|
);
|
|
|
|
[hashtable]$NewConfig = @{ };
|
|
|
|
# Remove passwords - do not store them inside our local config file
|
|
foreach ($entry in $Config.Keys) {
|
|
$Value = $Config[$entry];
|
|
|
|
$NewConfig.Add($entry, @{ });
|
|
|
|
foreach ($configElement in $Value.Keys) {
|
|
$confValue = $Value[$configElement];
|
|
|
|
if ($Value.Password -eq $TRUE -And $configElement -eq 'Values') {
|
|
$NewConfig[$entry].Add(
|
|
$configElement,
|
|
@( '***' )
|
|
);
|
|
} else {
|
|
$NewConfig[$entry].Add(
|
|
$configElement,
|
|
$confValue
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
Set-IcingaPowerShellConfig -Path 'Framework.Config.Swap' -Value $NewConfig;
|
|
}
|