VMware: Generate an URL for a VM Console Session

Hi,

with PowerCli it is simply possible to generate an direct Link to accessing a VM’s Console without clicking through the whole vSphere Tree.

The anatomy of the URL is
https://%vCenterFQDN%:9443/vsphere-client/vmrc/vmrc.jsp?vm=urn:vmomi:VirtualMachine:%MoRef%:%vCenterUUID%

function fGenerateWebfrontendURL([string]$sVM,[string]$sVCenter)
{
    $oVM=Get-VM $sVM -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
    $oVCenter=Get-VIServer $sVCenter -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
    if($oVM -and $oVCenter)
    {
        $sURL="https://"+$sVCenterHost+":9443/vsphere-client/vmrc/vmrc.jsp?vm=urn:vmomi:VirtualMachine:"+($oNewVM.ExtensionData.MoRef.Value)+":"+$oVCenter.InstanceUuid.ToUpper()
        return $sURL
    }
    return $null
}

PS D:\> fGenerateWebfrontendURL myVM myVcenter

Michael

Advertisment to support michlstechblog.info

Add a comment »3 comments to this article

  1. This does not seem to be working for vcenter6.5. Could you provide url format and ways to generate url for vcenter6.5

    Reply

    • Hi,

      unfortunately I havn’t a running 6.5 instance here.

      Michael

      Reply

      • Thanks for reply… pls do update if u get a chance to work on 6.5…

        Reply

Time limit is exhausted. Please reload CAPTCHA.

Original Theme by Schiy · Powered by WordPress