Private/Get-DataFromOrderedDic.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
function Get-DataFromOrderedDic { param( [parameter(Mandatory = $true)] $OrderedDic, [parameter(Mandatory = $false)] $Parent ) $a = $OrderedDic $vars = $a.Keys foreach ($x in $vars) { if (($a.$x | Get-Member -ErrorAction SilentlyContinue).TypeName -eq "System.Collections.Specialized.OrderedDictionary") { foreach ($y in $a.$x) { if ($Parent) { Get-DataFromOrderedDic $y "$($Parent).$x" } else { Get-DataFromOrderedDic $y $x } } } else { if ($Parent) { if ($($a.$x) -notin $null, " ", "notConfigured") { "| $($Parent).$($x) | $($a.$x) |`n" } } else { if ($($a.$x) -notin $null, " ", "notConfigured") { "| $($x) | $($a.$x) |`n" } } } } } |