Files
Resolve-DSCConfigurationData/Private/Resolve-ConfigurationDataValue.ps1
Torsten Brendgen 4b83abc7f2 initial Commit
2026-06-27 00:36:04 +02:00

45 lines
1.2 KiB
PowerShell

function Resolve-ConfigurationDataValue {
[CmdletBinding()]
Param(
[AllowNull()]
$Value,
[Parameter(Mandatory=$true)]
$Context
)
if($null -eq $Value){
return $null
}
if($Value -is [System.Collections.Specialized.OrderedDictionary]){
$Resolved = [ordered]@{}
foreach($Entry in $Value.GetEnumerator()){
$Resolved[$Entry.Name] = Resolve-ConfigurationDataValue -Value $Entry.Value -Context $Context
}
return $Resolved
}
if($Value -is [System.Collections.Hashtable]){
$Resolved = @{}
foreach($Entry in $Value.GetEnumerator()){
$Resolved[$Entry.Name] = Resolve-ConfigurationDataValue -Value $Entry.Value -Context $Context
}
return $Resolved
}
if($Value -is [System.Array] -and $Value -isnot [string]){
$Resolved = @()
foreach($Item in $Value){
$Resolved += ,(Resolve-ConfigurationDataValue -Value $Item -Context $Context)
}
return ,$Resolved
}
if($Value -is [string] -and (Test-ConfigurationDataExpression -Value $Value)){
return Resolve-ConfigurationDataExpression -Expression $Value -Context $Context
}
return $Value
}