Did you know that VMware stores a lot of information about your virtual machines? And that you can retrieve all that data with PowerCLI?

When you retrieve an object from vCenter or your ESXi host you get a lot of information. When you use Get-VM the object returned contains  multiple properties. Each property can have a single value or multiple values. Taking a look into the virtual machine object, you see a property called ExtensionData. That property contains. Each VM object has a lot of information stored with it in the ExtensionData property.

Try the next cmdlet, replace Photon with a machine in your environment:

$VM=Get-VM -name Photon

or in one line:

Get-VM -Name Photon | ForEach-Object {$_.ExtensionData}

or even shorter:

(Get-VM -Name Photon).ExtensionData

You get sometime like this, depending on your virtual machine:

Capability           : VMware.Vim.VirtualMachineCapability
Config               : VMware.Vim.VirtualMachineConfigInfo
Layout               : VMware.Vim.VirtualMachineFileLayout
LayoutEx             : VMware.Vim.VirtualMachineFileLayoutEx
Storage              : VMware.Vim.VirtualMachineStorageInfo
EnvironmentBrowser   : EnvironmentBrowser-envbrowser-41
ResourcePool         : ResourcePool-resgroup-8
ParentVApp           :
ResourceConfig       : VMware.Vim.ResourceConfigSpec
Runtime              : VMware.Vim.VirtualMachineRuntimeInfo
Guest                : VMware.Vim.GuestInfo
Summary              : VMware.Vim.VirtualMachineSummary
Datastore            : {Datastore-datastore-12}
Network              : {Network-network-14}
Snapshot             :
RootSnapshot         : {}
GuestHeartbeatStatus : gray
LinkedView           :
Parent               : Folder-group-v3
CustomValue          : {}
OverallStatus        : green
ConfigStatus         : green
ConfigIssue          : {}
EffectiveRole        : {-1}
Permission           : {}
Name                 : Photon
DisabledMethod       : {MakePrimaryVM_Task, TerminateFaultTolerantVM_Task,
                       ResetVM_Task, UnmountToolsInstaller...}
RecentTask           : {}
DeclaredAlarmState   : {alarm-10.vm-41, alarm-11.vm-41, alarm-2.vm-41,
TriggeredAlarmState  : {}
AlarmActionsEnabled  : True
Tag                  : {}
Value                : {}
AvailableField       : {}
MoRef                : VirtualMachine-vm-41
Client               : VMware.Vim.VimClientImpl

The items that start with VMware.Vim are properties described in the vSphere API reference documentation.

Getting information

For example: If you want to know if  VMware tools are running for a particular machine, Photon in this case, you can use the the following command:

(Get-VM -Name Photon).ExtensionData.Guest.ToolsRunningStatus

The reply would be in my case ‘guestToolsRunning’.

Or if you want to know what the uptime is for your VM you could just check ExtensionData:

[timespan]::fromseconds((Get-VM -Name Photon).ExtensionData.Summary.QuickStats.UptimeSeconds)


Days : 86
Hours : 23
Minutes : 4
Seconds : 51
Milliseconds : 0
Ticks : 75134910000000
TotalDays : 86.9617013888889
TotalHours : 2087.08083333333
TotalMinutes : 125224.85
TotalSeconds : 7513491
TotalMilliseconds : 7513491000


Now you

What are you doing with ExtensionData?