Created
December 11, 2013 01:26
-
-
Save bortels/7903570 to your computer and use it in GitHub Desktop.
Open Remote VMWare Console in powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on http://sourceforge.net/p/vghetto/code/HEAD/tree/scripts/generateHTML5VMConsole.pl#l54 | |
# Requires Openssl - get it from http://www.openssl.org/related/binaries.html | |
$openssl = "C:\OpenSSL-Win64\bin\openssl.exe" | |
$vm = get-vm -name "canary" | |
# Get the session associated with the vcenter this VM is on. Ugly Hack. | |
# /[email protected]:443/VirtualMachine=VirtualMachine-vm-804/ | |
$uid = $vm.uid | |
($junk, $fqdn) = $uid.split('@') | |
($fqdn, $junk) = $fqdn.split(':') | |
$session = get-view sessionmanager -server $fqdn | |
$ticket = $session.AcquireCloneTicket() | |
$mo_ref = (Get-view -VIObject $vm).MoRef | |
# now we have to get the thumbprint of the webserver. Easy? no. Sigh. | |
#--- | |
$url = "http://" + $server + ":7331/console/" + | |
"?vmId=" + $dict['vmid'] + | |
"&vmName=" + $dict['vmName'] + | |
"&host=" + $destvc + | |
"&sessionTicket=" + $dict['ticket'] + | |
"&thumbprint=" + $dict['thumbprint'] | |
$url |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment