WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud
  • Tanzu
    • Application Modernization
    • Tanzu services
    • Tanzu Community Edition
    • Tanzu Kubernetes Grid
    • vSphere with Tanzu
  • Home Lab
  • Nested Virtualization
  • Apple
You are here: Home / Automation / Customizing the ESXi DCUI to show number of VMs

Customizing the ESXi DCUI to show number of VMs

05.24.2016 by William Lam // 7 Comments

Last week there was a question that was posted internally asking if it was possible to customize the ESXi DCUI screen to include the number of Virtual Machines? Although there is nothing out of the box, you can in fact add add almost anything to the DCUI screen by modifying the /etc/vmware/welcome configuration file which I had blogged about several years back on adding a splash of color to the ESXi DCUI. There was even a recent VMware Fling that provides a VIB that applies a variety of DoD STIG implementations, one of which was to update the DCUI screen with some specific text.

However, instead of having to manually edit the file directly on the ESXi host, we also provide an API in the way of an ESXi Advanced Setting called Annotations.WelcomeMessage which can then be updated remotely using anyone of the vSphere SDK/CLIs that you are familiar with.

Here is an example PowerCLI snippet to connect to an ESXi host (you can also do this by connecting to vCenter Server) and extracting all Virtual Machines residing on the host and then updating the DCUI screen with the total number of VMs as well as the names of each VM. Obviously, if you have more than 10 or so VMs, it may not make much sense to actually list them as it will just run off the screen, but this just gives you an example of some of the things you can do leveraging the vSphere API or any other data that you might have at your disposal.

Connect-VIServer -Server 192.168.1.50 -User root -Password vmware123

$vms = Get-View -ViewType VirtualMachine -Property Name

$DCUIString = "{color:yellow}
                {esxproduct} {esxversion}

                Hostname: {hostname}
                IP: {ip}
                
                Virtual Machines: " + $vms.Count + "
{/color}
{color:white}
"

foreach ($vm in $vms) {
    $DCUIString += "`t`t" + $vm.Name + "`n"
}

Set-VMHostAdvancedConfiguration -Name Annotations.WelcomeMessage -Value $DCUIString

Disconnect-VIServer -Confirm:$false

Note: If you wish to only filter out powered on Virtual Machines, you can add the following: -Filter @{"Runtime.PowerState" = "PoweredOn"} to the end of the Get-View command

Here is a screenshot quick screenshot of what this would look like on the DCUI screen of your ESXi host:

displaying_vms_in_esxi_dcui_1
Note: You can actually run the DCUI over SSH, which can be useful for testing purposes without having to directly login to the console remotely. Take a look at this blog post here for more details.

One final thing to be aware of when editing the welcome message on your ESXi host is that it will also be displayed in the ESXi Embedded Host Client login page as shown in the screenshot below. Just something to be aware of in case you plan to make any sensitive information available as this can be seen without needing to login to the ESXi host (just like the DCUI interface).

displaying_vms_in_esxi_dcui_2

More from my site

  • How do you "log a reason" using PowerCLI when rebooting or shutting down ESXi host?
  • Identifying ESXi boot method & boot device
  • Quick Tip - How to retrieve the ESXi Update Level using the vSphere API?
  • Using the vSphere API to remotely collect ESXi esxcfg-info
  • Using ESXi-Arm Fling as a lightweight vSphere Automation environment for PowerCLI and Terraform

Categories // Automation, ESXi Tags // dcui, esxi, PowerCLI, vSphere API

Comments

  1. Darshan Kolambkar says

    05/24/2016 at 10:02 am

    This will really help us to search vcenter server incase we loss connectivity

    Reply
  2. cragdoo says

    05/25/2016 at 2:16 am

    The comment above beat me to it, is it possible to create a filter that only shows a specific VM, as mentioned previously vcenter?

    Reply
    • William Lam says

      05/25/2016 at 6:23 am

      Yes, anything is possible 🙂

      This is just a simple -filter option: $vms = Get-View -ViewType VirtualMachine -Property Name -Filter @{"Name" = "VCSA-60u2"}

      If you're not familiar with PowerCLI, I recommend you have a look at their documentation https://www.vmware.com/support/developer/PowerCLI/ and there's plenty of examples online that you can search for as well

      Reply
  3. Mark says

    05/25/2016 at 9:03 am

    Is this setting a static message with the count and VM names at the time of execution, or will the list update dynamically?

    I'm guessing the former, but very cool in either case! I didn't know the DCUI was so easily modifiable. Thanks!

    Reply
    • William Lam says

      05/25/2016 at 9:05 am

      It's static, but easily scheduledable

      Reply
  4. Homelaber Brasil (@homelaber) says

    05/25/2016 at 11:21 am

    Hey there Lam! Fantastic tip! You really rocks! Thanks a lot for sharing.

    Cheers!
    Valdecir - São Paulo, Brazil

    Reply
  5. Michael Masters says

    06/26/2019 at 1:53 pm

    In 6.7 esx version ,hostname and IP I get null values, must be differnet....

    Reply

Thanks for the comment! Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Author

William Lam is a Senior Staff Solution Architect working in the VMware Cloud team within the Cloud Infrastructure Business Group (CIBG) at VMware. He focuses on Cloud Native technologies, Automation, Integration and Operation for the VMware Cloud based Software Defined Datacenters (SDDC)

Connect

  • Email
  • GitHub
  • LinkedIn
  • RSS
  • Twitter
  • Vimeo

Recent

  • How to disable the Efficiency Cores (E-cores) on an Intel NUC? 03/24/2023
  • Changing the default HTTP(s) Reverse Proxy Ports on ESXi 8.0 03/22/2023
  • NFS Multi-Connections in vSphere 8.0 Update 1 03/20/2023
  • Quick Tip - How to download ESXi ISO image for all releases including patch updates? 03/15/2023
  • SSD with multiple NVMe namespaces for VMware Homelab 03/14/2023

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2023

 

Loading Comments...