mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-21 15:19:58 -05:00
34 lines
890 B
PowerShell
34 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;
|
||
|
|
}
|