VMware {code} Community
LayerX
Contributor
Contributor

VMWare Remote Console

I have been trying to get VMWare-VMRC to launch either in the browser or by triggering the launch of the installed client (the way vCloud Director does it) for a week now and nothing seems to work.  I've found some posts that talk about mks.connect(....) and others mks.connectWithSession(...) but the CAB file I have complains that connectWithSession is not valid, so I'm wondering if there is a new version I can get somewhere?

In short, how does vCloud Director launch the remote console, all I want to do is trigger the same thing, the same way.

Reply
0 Kudos
17 Replies
geoffaviarc
Contributor
Contributor

I too have been trying this...

I can get the plugin to launch but it complains that the ticket is invalid.

there is no documentation that I know of from vmware...   they really need to release this.

Reply
0 Kudos
LayerX
Contributor
Contributor

Hello.  That's great news that you managed to launch it at least, can you share what you did? I've tried what I am sure is a dozen variations.

I'm thinking if we can't use the ticket then we can at least logon manually or something, getting it to launch is the first step for me....

Also, have you found any way to get the vShield external IP using the API yet?

Reply
0 Kudos
geoffaviarc
Contributor
Contributor

yeah...  in this post here I complain about the ticket issue.

http://communities.vmware.com/thread/305822?tstart=0

no I haven't found a way to get the vSheild appliances ext ip like the director gui does.

Reply
0 Kudos
LayerX
Contributor
Contributor

If the source code to that flex app was made public I'm sure these forums would be empty Smiley Happy

Thanks for the link, the issue I have with trying to use your example is that my object is:

<object width="100%" height="100%" id="mks" classid="CLSID:DC7D77DA-E1AC-4D40-930B-B87B2954E034" codebase="/downloads/vmware/vmware-mks.cab##version=2,0,1,0">

And yours is:

<object id="mks" type="application/x-vmware-vmrc;version=2.5.0.279773"></object>

Where do I get version 2.5?

If I try to do a connectWithSession(...) against my version it complains that the method is not supported.

Reply
0 Kudos
LayerX
Contributor
Contributor

Are you decoding the ticket before you use it? I've read that the ticket has to be URL Decoded before you can use it.

Reply
0 Kudos
geoffaviarc
Contributor
Contributor

I think the difference may be because the plugin is different across browsers and platforms.

I'm using firefox on linux and I'm aware that my code won't spawn it on ie/windows.

What puzzles me about the flex UI is that they could be using the same REST API but I think its obvious that they are not.

I'm getting pretty close to trying to run vlcoud director without ssl to wireshark the calls to the back end.

Reply
0 Kudos
geoffaviarc
Contributor
Contributor

Yeah I am URL decoding it but I may be getting that wrong.

Reply
0 Kudos
LayerX
Contributor
Contributor

Yeah seeing their calls would be useful.  I was told the UI does use the same API, but looking at the functionality I can't see how.

Reply
0 Kudos
jake_robinson_b
Hot Shot
Hot Shot

I have it working in my vCloud Powershell functions, if anyone would like to check it out:

https://github.com/jakerobinson/vCloud-Powershell

Jake Robinson VCP, vExpert - geekafterfive.com - Twitter: @jakerobinson
Reply
0 Kudos
geoffaviarc
Contributor
Contributor

I now have this working on both IE and firefox...

firefox            

     var objEl = document.createElement("object");

     objEl.setAttribute("id","mks");

     objEl.setAttribute("type","application/x-vmware-vmrc;version=2.5.0.279773");

     document.appendChild(objEl);

     objEl.connectWithSession(host,ticket,moref,2);

msie

     var objEl = document.createElement('object');

     objEl.setAttribute("id", "mks");

     objEl.setAttribute("classid", 'clsid:B94C2238-346E-4C5E-9B36-8CC627F35574');

     document.appendChild(objEl);

     objEl.connectWithSession(host,ticket,moref, 2);

I had to parse and decode the ticket in java.... and parse to the screen....  you could do this in javascript but I chose java as I'm using a servlet environment to render the page.

                  String host = "";

                  String moref = "";

                  String ticket = "";

                  int host_end = _ticket.indexOf("/", 7);

                  int moref_end = _ticket.indexOf("?", 7);

                  int ticket_start = _ticket.indexOf("=", 7);

                  host = _ticket.substring(6, host_end);

                  moref = _ticket.substring(host_end+1, moref_end);

                  ticket = _ticket.substring(ticket_start+1, _ticket.length());

                  try {

                      ticket = URLDecoder.decode(ticket, "UTF-8");

                   } catch (UnsupportedEncodingException e) {

                         System,out,println(e.getMessage());

                   }

next stop is detecting the plugin and presenting a download for the appropriate os/browser              

Reply
0 Kudos
LayerX
Contributor
Contributor

Hey thanks for that!!  Quick question, what MKS CAB file are you using and where can I get a copy?

Reply
0 Kudos
geoffaviarc
Contributor
Contributor

I'm just using the exe install that vcloud director has...

one other way to instanciate the plugin in IE is via

var plugin = new ActiveXObject('VMware.web.VMwareRemoteConsole.2.5');

I had to strings the dll on my linux machine to get that out of it....


Reply
0 Kudos
stevetran
Contributor
Contributor

Hi,

After a lot of searching, your post seems to be exactly what I'm after as I want to launch the console from a browser but with the PHP API.

Can you share the source, how you managed to get it working in ie and firefox please. I'm new to vmware and the api so step by step instructions would be very helpful.

So far where I am stuck is the following stage: got the mks url from the screenTicket Type object but don't know how to use the url or launch the console.

Also have you managed to detect the plugin and presenting a download for the appropriate os/browser?

Steve

Reply
0 Kudos
geoffaviarc
Contributor
Contributor

Yes I have done plugin detection... The plugins array in firefox will show you if its installed... Use java script iterate over the array till you find the plugin. In I.e the plugin is registered as an activex object so a simple attempt to instanciate it in javascript wrapped in a try catch will suffice.

The ticket returned is url encoded so you will have to run it through url decoder. And... Its not a url as such... Its actually a string of tokens. The console proxy host, the vm and the "ticket". you need to get a ref to the plugin object in java script and call the open function with the tokens as arguments.

I can't show you my code because its commercially sensitive. But if you post some code I could theoretically comment on it Smiley Happy

Cheers

Geoff

Sent from Samsung Mobile

Reply
0 Kudos
brangasamy
Contributor
Contributor

Hi,

Could you please post the complete solution for launching remote console? I am also doing in J2EE/ jsp page.

Some reason, it does not launch the console at all.

Also, are you using 1.0 remote console vmware-vmrc.exe or vmwareRemoteConsoleWeb.dll

I am also using the classid as B94C2238-346E-4C5E-9B36-8CC627F35574

Thanks again.

Bala

Reply
0 Kudos
naka999
Contributor
Contributor

In vSphere 4.1 (or older?), the sample code works from Internet Explorer. But In vSphre 5.0, it dos not work.

It seems VMware Remote Console Plug-in in vSphere 5.0 does not have connectWithSession API.

Does anybody know how to open Remote Console using vSphere 5.0 Remote Console plub-in?

Reply
0 Kudos
doskiran
Enthusiast
Enthusiast

Hi,

Thanks for your solution.For IE it is working fine. But for firefox with my vmrc plugin mimetype:"application/x-vmware-vmrc;version=2.5.0.199067" it is not working. And also i am see one more difference is, with same vmrc plugin is showing different mimetype version in IE & FF.

for IE it is showing mimetype::"application/x-vmware-vmrc;version=2.5.0.199067" and for FF mimetype:"application/x-vmware-remote-console-2011;version=4.0.0.10045". I tried with both minetype it is not working and also tried with your mimetype.Can you please suggest me where exactly the problem or VMRC plugin support FF or not.

Reply
0 Kudos