Public/Get-AllArrayData.ps1
Function Get-AllArrayData { <# .SYNOPSIS Accepts an array of objects and an array of strings (properties) then returns an array of strings containing all the data in one flat array, no objects .PARAMETER Array an array of objects .PARAMETER Properties an array of properties that match the array of objects .OUTPUTS outputs a flat array of provided array object values .EXAMPLE $Array --------------- Name : Luke Location : CE $Properties = Get-Properties $Array Get-AllArrayData -Array $Array -Properties $Properties luke CE #> [CmdletBinding()] param ( [Parameter( Mandatory )] $Array, [Parameter( Mandatory )] $Properties ) $AllData = @() foreach ($Entry in $Array) { foreach ($Property in $Properties) { $AllData += $Entry.$Property } } Return $AllData } |