WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / Generating a vSphere UI link to a specific Virtual Machine

Generating a vSphere UI link to a specific Virtual Machine

04.05.2023 by William Lam // 2 Comments

For some organizations, after a VM has been provisioned, it is customary to send a notification (email, slack, etc) to their end users with login credentials including the URL for the vSphere UI.

Typically, the provided URL is just the vCenter Server base URL and end users would then have to login and navigate to their specific VM(s) within the vSphere Inventory. A question was brought up on whether a better end user experience could be provided to their internal users? They were interested in providing their end users with a specific URL link that would take them directly to their VM, which they can also bookmark for future uses.

Furthermore, the customer was also interested in generating the URL programmatically, so that it can be incorporated into their existing provisioning workflows.

This can easily be achieved as each inventory object in the vSphere UI has a unique URL. For the purpose of this blog post, I will primarily be focusing on the VM inventory object, which can exists under the Hosts/Clusters view or VM/VM Templates view, but the concept will apply to other vSphere Inventory objects.

Under the Hosts/Clusters view, the URL for a VM would look like the following: https://vcsa.primp-industries.local/ui/app/vm;nav=h/urn:vmomi:VirtualMachine:vm-40043:056a402b-2b3d-4f74-93f7-fa818adff697/summary

Under the VM/VM Template view, the URL for a VM would look like the following: https://vcsa.primp-industries.local/ui/app/vm;nav=v/urn:vmomi:VirtualMachine:vm-40043:056a402b-2b3d-4f74-93f7-fa818adff697/summary

As you can see from both URLs above, the only difference is the "nav=" key that specifies whether the view is in the Hosts/Clusters (h) or VM/VM Templates (v) and the rest of the URL is the same including the VM Managed Object Reference (MoRef) ID in blue and the vCenter Server Instance UUID in orange.

With all of this information, we can easily automate the generation of the URL for a specific VM within the vSphere UI. To demonstrate this, we will be using the vSphere API and consuming that through PowerCLI with the following snippet:

$vmName = "Rocky-Linux-9"
$uiView = "v"

$vcHostname = $global:DefaultVIServer.name
$vcInstanceUUID = $global:DefaultVIServer.InstanceUuid
$vmId = ((Get-VM $vmName).id).replace("VirtualMachine-","VirtualMachine:")

Write-Host "https://${vcHostname}/ui/app/vm;nav=${uiView}/urn:vmomi:${vmId}:${vcInstanceUUID}/summary"

Note: Users will still need to login to vCenter Server even with the direct link to their VM and if they do not have the appropriate permissions, they will not be able to view or do anything.

More from my site

  • Updated vSphere Login UI customizations for vSphere 7.x & 8.x
  • vSphere Code Capture is your ChatGPT for vSphere Automation
  • Creating custom ESXi images using vSphere Lifecycle Manager (vLCM) UI and PowerCLI cmdlets for vSphere 8
  • How to restrict vSphere UI access while maintaining vSphere API functionality?
  • How to quickly deploy new CoreOS Image w/VMware Tools on ESXi?

Categories // Automation, vSphere, vSphere Web Client Tags // vSphere UI

Comments

  1. *protectedhenketh says

    04/06/2023 at 1:02 am

    Where do I find the "VM Managed Object Reference (MoRef) ID and the vCenter Server Instance UUID" for a specific VM?

    Reply
    • William Lam says

      04/06/2023 at 10:29 am

      Did you take a look at the blog post, the details are there 🙂

      Reply

Thanks for the comment!Cancel reply

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

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • VMUG Connect 2025 - Minimal VMware Cloud Foundation (VCF) 5.x in a Box  05/15/2025
  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025

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 © 2025

 

Loading Comments...