Private/Get-EFPropertyValue.ps1
|
function Get-EFPropertyValue { [CmdletBinding()] param( [AllowNull()] [Parameter(Mandatory)] [object]$InputObject, [Parameter(Mandatory)] [string]$Name, [AllowNull()] [object]$Default = $null ) if ($null -eq $InputObject) { return $Default } if ($InputObject -is [System.Collections.IDictionary] -and $InputObject.Contains($Name)) { return $InputObject[$Name] } $property = $InputObject.PSObject.Properties[$Name] if ($null -eq $property) { return $Default } return $property.Value } |