How to use the vCenter Managed Object Browser

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.

MOB Key Components

  • Property Path: Used to identify where you are within an object. The path can be “walked” to reach specific information.
  • Properties/Attributes: The information on part of the path, referencing this property with something like PowerCLI or vRO will return the value of the property, for example vm.name would return the name of the virtual machine object you are working with.
  • Property Types: The property type shows what form the data is, such as string, number, or another object. When the value of a property is another object, the path can continue to be walked.
  • Parent Object Managed ID: This is often known as the moRef value, it is a unique ID generated by vCenter for a given object. This will be shown at the top of the page for the object you are in.
  • Browser Address Bar: The address bar gives you a direct link to wherever you are in the MOB, https://<vcenter-server-IP-or-FQDN>/mob/?moid=vm-725&doPath=guest - including the moRef of the vCenter object (e.g. vm-725)

MOB Guided Tour

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.

  1. Click on the link for content.

The top level location within the MOB, which provides links to vSphere 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.

  1. Click on the link against the property rootFolder, the value should be group-d1 (Datacenters)

Service contents and access to the rootFolder (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 ( ).

  1. Click on one of your Datacenters.

Top level Datacenter object

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).

  1. Click the link next to vmFolder.

Top level VM folder object

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.

  1. Find a virtual machine and click its link, if your VMs are organised into folders select one of those to find a VM object (remember to look for an object that starts vm-).

VM folder object with child entities, such as folders and ungrouped virtual machines

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.

  1. Next, click the link next to the guest property.

Virtual Machine object page with link to guest page highlighted

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?

Virtual Machine guest information

  1. Go back a page to the top level of the virtual machine object you selected, scroll down and select summary

Virtual Machine object page with link to summmary page highlighted

Take note of the Property Path at the top of the page, this currently shows summary.

  1. Press the config link

Virtual Machine summary page with link to config page highlighted

Check 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

Virtual Machine summary.config page with highlighted properties

Example with PowerCLI

  • Install PowerCLI: Install-Module -Name VMware.PowerCLI.
  • Connect to vCenter: Connect-VIServer -Server "vcenter.domain.com" -User "username" -Password "password".
  • Get the VM object we looked at earlier in the MOB: $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.

  • Output all ExtensionData, cross reference what you see as an output with what you see in the MOB: $vm.extensiondata.
  • Get the hostName of our VM object (step 6 above): $vm.extensiondata.guest.hostname.
  • Get the guestFullName of our VM object (step 8 above): $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.

Example with vRO

  • Create a new workflow, name it VM Details.
  • Create a new Input call vm with the type VC:VirtualMachine.

Workflow Inputs tab, showing vm as an input of type VC:VirtualMachne

  • Drag a Scripting object on to the canvas, between the Start and End, rename it if necessary.

Workflow canvas with scripting object between Start and End items

  • Map the Input to the scripting object

Scripting object In tab showing an input mapping to the workflow Input

  • Update the code within the scripting object

Scripting object script

System.log(vm.guest.hostName);
System.log(vm.summary.config.guestFullName);
  • Run the workflow, the output should show the same information as vCenter
Published 16 Nov 2020

Tags


Automation Consultant, currently working at Xtravirt. Interested in all things automation/devops related.
Sam Perrin on Twitter