I find that I frequently want to see the members of objects I am working with, and prefer to do this in a GridView. If, however, there are objects of different types in the collection there can be issues.  When simply  sending the collection to Get-Member there are separate results for each object type, but when then piping this to Out-GridView the member collections get merged in to one GridView.

To get around this I wrote my own cmdlet Out-MemberToGridView which launches a new GridView for each object type in the collection.

function Out-MemberToGridView{[CmdletBinding()]Param([parameter(ValueFromPipeline=$true)][Object]$inputObject,[string]$Title,[Switch]$Wait)

Begin{[String]$objectTypes = @()}Process{$objectTypeName = $PSItem.GetType().FullNameif (-not ($objectTypes.Contains($objectTypeName))){$objectTypes += $objectTypeNameif ([String]::IsNullOrEmpty($Title)){$GridTitle = $objectTypeName}else{$GridTitle = $Title}$PSItem | Get-Member | Out-GridView -Title $GridTitle -Wait:$Wait}}End{}}



Feature Articles


Blog
What to look for in a cloud security system and in training?
By Leif Pedersen | 19 February 2024
Blog
Bridging the gap between innovation and safety with AWS security training
By Leif Pedersen | 26 January 2024
eBook
Drive Innovation with IT Service Management Training
11 December 2023
Blog
Unleashing the Power of Data Analytics: A Call for Governments and Public Sector Agencies
By Chloe Villanueva | 20 November 2023