The Managed Object Browser or MOB is a tool that is bundled with vCenter and ESXi, and it can be used to visually explore the structure of various vSphere related objects, such as Virtual Machines, Datastores and Clusters. This becomes invaluable when developing automation or reporting on infrastructure.
Each object within the MOB contains an array of data, from common information such as the objects name, configured CPU & Memory or its overall status, to less explored data such hardware device keys, VMX file paths and snapshot tree structure.
Not only can the MOB be used to explore this information, but it can also be used to invoke various methods against the various objects. For example, when viewing a Virtual Machine object you can invoke ShutdownGuest
and CreateSnapshot
tasks.
vm.name
would return the name
of the virtual machine object you are working with. string
, number
, or another object
. When the value of a property is another object, the path can continue to be walked.https://<vcenter-server-IP-or-FQDN>/mob/?moid=vm-725&doPath=guest
- including the moRef of the vCenter object (e.g. vm-725
)To connect to your vCenter MOB, navigate to https://<vcenter-server-IP-or-FQDN>/mob
and login with valid credentials.
At the top of your page you should see a table, the first column is the property/attribute name, followed by its type, and then the value. This structure will be used throughout the MOB.
content
.This second page shows us various Service Managers that vCenter provides, such as FileManager
and OvfManager
, these provide various actions and functions, but for now we are only interested in consuming existing information.
rootFolder
, the value should be group-d1 (Datacenters)
At the top of this next page you will see a childEntity
property, you should see some familiar values here - your Datacenters, their names will be shown within brackets ( ).
Datacenters
.Within the Datacenter object screen you will see a lot of familiar information, this is the real start of what you would see within vCenter. On this page you will see links to your Datastores and Networks. At the bottom you will also see vmFolder
.
You might have noticed that Datastores start with datastore-
and Networks start with network-
. As you browse the MOB you will see that various vSphere related objects have a naming prefix to them. (vm-
for VMs, host-
for Hosts etc).
vmFolder
.Inside the top level VM folder, which has the name vm
(find the name
property), you will find all child folders as well as any virtual machines that have not been organised in to a folder. This is the root, or top level, vm folder - some applications such as govc
rely on this when providing the path to an object, for example if you wanted to move a vm in to a folder: govc object.mv /dc1/vm/vm-foo-* /dc1/vm/folder-foo
.
vm-
).Take some time to look through this object, take note of the values against the datastore
and network
properties. Now compare these to what you see within the vCenter UI, they should match.
guest
property.We are now looking at the guest
information for our Virtual Machine. Take a look at the guestState
and hostname
properties. Once again, these should match what you see within vCenter - is the VM powered on or off? What is the hostname shown on the summary tab?
summary
Take note of the Property Path
at the top of the page, this currently shows summary
.
config
linkCheck the Property Path
again, you should now see that we are in summary.config
. The path shows us where we are within an object, so at the moment we are within vm.summary.confg
.
Take a look at some of the properties listed here, such as the guestFullName
, check it against vCenter. The full path to this property would be vm.summary.config.guestFullName
Install-Module -Name VMware.PowerCLI
.Connect-VIServer -Server "vcenter.domain.com" -User "username" -Password "password"
.$vm = Get-VM -Name "vm-name"
.To access the data we would normally see on an object within the MOB, via PowerCLI, we need to use the ExtensionData
property.
$vm.extensiondata
.$vm.extensiondata.guest.hostname
.$vm.extensiondata.summary.config.guestFullName
.Ignoring the ExtensionData property, we can see in the two simple examples above that the path we have gone down to get our data through PowerCLI matches the same path we went down to get the data from MOB.
vm
with the type VC:VirtualMachine
.System.log(vm.guest.hostName);
System.log(vm.summary.config.guestFullName);