VMware Cloud Community
esxi1979
Expert
Expert

Get-Dtacenter extensio data

Hi,

How to pull info from extension data for datacenter Please ?

PowerCLI C:\> (Get-Datacenter -name xxxx).extensiondata.Configuration

DefaultHardwareVersionKey

-------------------------

DefaultHardwareVersionKey & other coloumns in this o/p are blank..

0 Kudos
7 Replies
Wh33ly
Hot Shot
Hot Shot

What kind of information are you looking for ? Try to be a bit more specific

0 Kudos
LucD
Leadership
Leadership

That is the only property available under Configuration.

See the DatacenterConfigInfo object description.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
esxi1979
Expert
Expert

extensiondata does allow to do some api calls .. to get more info which does not come with get-datacenter -name xyz .. so i am trying to get that info

so may be the info come from the summary page when we click the DC & more ..

0 Kudos
esxi1979
Expert
Expert

Thanks Luc

Can you help how to use that page  you shared ?

0 Kudos
LucD
Leadership
Leadership

The info on the Summary page is available on the Datacenter object itself.

For example, the number of VM in the Datacenter can be retrieved recursively through the vmFolder property.

function Get-VMInFolder {

    param([VMware.Vim.ManagedObjectReference]$FolderMoRef)

    $nrVM = 0

    $folder = Get-View -Id $FolderMoRef

    $folder.ChildEntity | %{

        if($_.Type -match 'VirtualMachine'){

            $nrVM += 1

        }

        elseif($_.Type -match 'Folder'){

            $nrVM += (Get-VMInFolder -FolderMoRef $_)

        }

    }

    $nrVM

}

$dcName = "MyDC"

$dc = Get-Datacenter -Name $dcName

Get-VMInFOlder -FolderMoRef $dc.ExtensionData.VmFolder 

Note that this small script doesn't make a distinction between VMs and Templates, but it should give you an idea what can be done.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

esxi1979
Expert
Expert

Thanks !

Going back tp the same topics

PowerCLI C:\> (Get-Datacenter -name xxxx).extensiondata.Configuration

DefaultHardwareVersionKey

-------------------------

DefaultHardwareVersionKe

can we make/use out of this output any fruitful way eg below gives useful info :-

PowerCLI C:\> (get-vm -name xxxx).extensiondata.config.guestid

rhel6_64Guest

PowerCLI C:\>

0 Kudos
LucD
Leadership
Leadership

Every info is potentially useful, it just depends what you are looking for.

But like I said earlier, the Configuration on a Datacenter vSphere object doesn't contain a lot of information.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos