Link to home
Start Free TrialLog in
Avatar of Blowfelt82
Blowfelt82

asked on

Output data from multiple piped cmdlets and format it into table

Say I have a number of piped PowerCLI cmdlets:

Get-VM | Get-VMHost | Get-Portgroups

How can I select the columns from each level of the command e.g:

Select Get-VM.Name, Get-VMHost.ID, Get-VMHost.Memory, Get-PortGroups.ID

Note: It is likely that different cmdlets will return identically named columns.

It is also likely that each cmdlet may return multiple lines of data e.g. a VMHost might have multiple VMs associated with it - I want to display this data in a table as follows (I doubt its possible but if columns/rows can use spanning to make the table more presentable even better):

HOST1 | VM1 | PortGroup1
HOST1 | VM1 | PortGroup2
HOST1 | VM1 | PortGroup3
HOST2 | VM2 | PortGroup1
HOST2 | VM2 | PortGroup2
HOST2 | VM3
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial