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..
What kind of information are you looking for ? Try to be a bit more specific
That is the only property available under Configuration.
See the DatacenterConfigInfo object description.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
so may be the info come from the summary page when we click the DC & more ..
Thanks Luc
Can you help how to use that page you shared ?
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
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:\>
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