generateVMRemoteConsoleURL.pl

Version 3

    Motivated by this thread: Programatically Generate Remote Console URL, here is a script that will generate the proper remote console URL for vSphere vCenter 4.0

    Requirements:
    vCenter 4.0
    ESX(i) 4.0
    vSphere SDK for Perl or vMA 4.0

    Sample Execution:

    Do not obfuscate URL:

    [vi-admin@scofield ~][http://reflex.primp-industries.com|http://reflex.primp-industries.com]$ ./generateVMRemoteConsoleURL.pl --server reflex.primp-industries.com --username primp --obfuscate 0 --vmname William-XP
    https://reflex.primp-industries.com/ui/?wsUrl=http://localhost:80/sdk&mo=VirtualMachine|vm-91&inventory=none&tabs=hide_



    Obfuscate URL:

    [vi-admin@scofield ~][http://reflex.primp-industries.com|http://reflex.primp-industries.com]$ ./generateVMRemoteConsoleURL.pl --server reflex.primp-industries.com --username primp --obfuscate 1 --vmname William-XP
    https://reflex.primp-industries.com/ui/?view=aHR0cDovL2xvY2FsaG9zdDo4MC9zZGsmbW89VmlydHVhbE1hY2hpbmV8dm0tOTEmaW52ZW50b3J5PW5vbmUmdGFicz1oaWRlXw==



    There are two other optional flags that can be set which are --limit_single_vm_view and --limit_workspace_view which is described in the vSphere Web Access for vCenter when  generating the URL which can be set in this script to provide the  correct permissions in the URL. By default both parameters have a  default of 1 or enabled, you may set it to false by passing in the value of 0

    remoteURL.png


    Download script here.