function Resolve-ConfigurationDataValue { [CmdletBinding()] Param( [AllowNull()] $Value, [Parameter(Mandatory=$true)] $Context, [object[]] $Path = @() ) if($null -eq $Value){ return $null } if($Value -is [System.Collections.Specialized.OrderedDictionary]){ $Resolved = [ordered]@{} foreach($Entry in $Value.GetEnumerator()){ if($Entry.Name -eq "Sealed"){ continue } $Resolved[$Entry.Name] = Resolve-ConfigurationDataValue -Value $Entry.Value -Context $Context -Path (@($Path) + @($Entry.Name)) } return $Resolved } if($Value -is [System.Collections.Hashtable]){ $Resolved = @{} foreach($Entry in $Value.GetEnumerator()){ if($Entry.Name -eq "Sealed"){ continue } $Resolved[$Entry.Name] = Resolve-ConfigurationDataValue -Value $Entry.Value -Context $Context -Path (@($Path) + @($Entry.Name)) } return $Resolved } if($Value -is [System.Array] -and $Value -isnot [string]){ $Resolved = @() for($Index = 0; $Index -lt $Value.Count; $Index++){ $Resolved += ,(Resolve-ConfigurationDataValue -Value $Value[$Index] -Context $Context -Path (@($Path) + @($Index))) } return ,$Resolved } if($Value -is [string] -and (Test-ConfigurationDataExpression -Value $Value)){ $PreviousPath = @($Context.CurrentPath) $Context.CurrentPath = @($Path) try { return Resolve-ConfigurationDataExpression -Expression $Value -Context $Context } finally { $Context.CurrentPath = $PreviousPath } } return $Value }