Got a question? Call 1800 853 276   |   

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

Insights to help you craft your End of Financial Year Learning and Development Plan
By Chloe Villanueva | 28 March 2022
Cyber Security Fireside Chat - Introduction to CISSP
By Jeremy Daly | 6 April 2022
Innovate boldly and with peace of mind when you access AWS security training
By Chloe Villanueva | 25 April 2022
DDLS and PECB partner to deliver ISO 27001 Information Security Training
By Chloe Villanueva | 2 May 2022