Creating af Link for VMRC to a VM

November 3, 2020 0 By Allan Kjaer

Had a customer that needed the abillity to create a link/URL to connect the VMware Remote Console (VMRC), that he could send to a admin for for troubleshooting, without the use having access to the vCenter.

This can be done thru the API or PowerCLI.

The script is inspired by a script made by LucD.

connect-viserver <vCenter server> -user <console user name>
$vmName = ”<VM name>”
$vm = Get-VM -Name $vmName
$mksTicket = $vm.ExtensionData.AcquireMksTicket()
$result = "vmrc://$($vm.VMHost.Name):902/?mksticket=$($mksTicket.Ticket)&thumbprint=$($mksTicket.SslThumbPrint)&path=$($mksTicket.CfgFile)"
$result

Use the result can be used in a browser, and requies that the VMware Remote Console i installed.

This have only been tested on vCenter 6.7.3, and I don’t know if it supported.

NOTE: The link for the VMRC is created directly for the host that the VM is running on, and not vCenter, so if the VM vMotions away you cant connect, or if connected, loses the connection. Hope this will be fixed in the future. It looks like the unsupported REST API might support connection thru vCenter. Have not testet it.

Please share this page if you find it usefull: