halr9000
Commander
Commander

How to discover inventory items within a cluster

I'm answering this question posted in the Perl forum:

I'm looking for a script (or options to vidiscovery.pl that I have missed) that will simply give me the same list items that I see in the VMware Infrastructure Client under Hosts & Clusters.

vidiscovery.pl does not "discover" anything because you have to provide the name of the entity to see the entities contents.

In PowerShell:

PS > Get-Cluster | Get-Inventory | ft { $_.GetType().name }, Name

$_.GetType().name                           Name
------------------                          ----
VMHostImpl                                  192.168.0.51
ResourcePoolImpl                            Resources
VirtualMachineImpl                          vcenter.halr9000.com

Hal Rottenberg

Co-Host, PowerScripting Podcast (http://powerscripting.net)

My signature used to be pretty, but then the forum software broked it. vExpert. Microsoft MVP (Windows PowerShell). Author, Podcaster, Speaker. I'm @halr9000
0 Kudos
1 Reply
BlackHawk-VM
Contributor
Contributor

Just to take it a half-step farther and pretty it up a little try this:

Get-Cluster | Get-Inventory | Sort-Object -property @{expression={$_.GetType().Name};Descending=$true}, @{expression="name";ascending=$true} | ft @{Label="VItype";expression={$_.GetType().Name}}, Name

Ciao;

Greg

0 Kudos