Direct Link to VM in the vCenter HTML5 interface.

Written by Luke Arntz on November 20, 2019
[ vCenter ] [ code ] [ csharp ]



I find it useful when I generate automated reports to have a link directly to the virtual machine(s) in the report. The example below is written in C#, but the link format is the same regardless of way it is generated.

Link Structure Info

Link contains:

  • VM MoRef (value only)
  • vCenter UUID

HTML Format

C# Example

Regex serverFromURL = new Regex(@"(?'server'^https://\S+\.\S+\.\S+)/sdk");
Match server = serverFromURL.Match(vimClient.ServiceUrl);
String.Format("<a href=\"{0}/ui/#?extensionId=vsphere.core.vm.summary&objectId=urn:vmomi:VirtualMachine:{1}:{2}&navigator=vsphere.core.viTree.vmsAndTemplatesView\">{3}</a>", server.Groups["server"],virtualMachine.MoRef.Value, vimClient.ServiceContent.About.InstanceUuid, virtualMachine.Named);


Related Articles