Public/Get-ObjectData.ps1
function Get-ObjectData { [CmdletBinding()] param( $Object, $Title, [switch] $DoNotAddTitles ) $ArrayList = New-Object System.Collections.ArrayList $Values = $Object.$Title Write-Verbose "Get-ObjectData1: Title $Title Values: $Values" if ((Get-ObjectCount $values) -eq 1 -and $DoNotAddTitles -eq $false) { $ArrayList.Add("$Title - $Values") | Out-Null } else { if ($DoNotAddTitles -eq $false) { $ArrayList.Add($Title) | Out-Null } foreach ($Value in $Values) { $ArrayList.Add("$Value") | Out-Null } } Write-Verbose "Get-ObjectData2: Title $Title Values: $(Get-ObjectCount $ArrayList)" return $ArrayList } |