VMware {code} Community
VIGuru
Contributor
Contributor

Embedding virtual machine console for ESX 4.0 (vmware-vmrc-win32-x86.exe)

Hello I have read and used the following

However this has not been updated for vmware-vmrc-win32-x86.exe

Can someone tell me how to embed the console in a webpage as was possible with MKS

thanks in advance.

0 Kudos
23 Replies
Steve_Jin
Expert
Expert

Check out my blog:

http://www.doublecloud.org/2010/02/3-easy-ways-connecting-to-your-vm-in-private-cloud/

Steve JIN

Author of VMware VI and vSphere SDK (Prentice Hall)

Creator of open source vSphere (VI) Java API(Tutorial, Testimonials, Download, Samples)

Blog: DoubleCloud.ORG ( Top 10 Best Practices,[Common Mistakes|http://www.doublecloud.org/2010/01/31/common-mistakes-using-vmware-vi-and-vsphere-sdk/], Tiny REST API)

Steve JIN Author of VMware VI and vSphere SDK; Creator of open source VI Java API (http://vijava.sf.net); Blogger at http://www.doublecloud.org
0 Kudos
VIGuru
Contributor
Contributor

Ok thanks for that link however your example number 2. still uses the vmware-mks.cab file. Where is this file in vSphere?

I have tried the ESX and the Virtual center server and only have the executable. vmware-vmrc-win32-x86.exe

Are you saying that I need the old .cab from an ESX 3.5 box and use the previous method to connect?

0 Kudos
epletsch
Contributor
Contributor

Well, I can't tell you how to do it, but I can tell you that there are others who are also fighting with the same issue.

What I have learned so far is that the new plugin (version 2.5) is completely different from the old plugin. New COM name, new method signatures, etc. It also doesn't work like the old one did, which is very frustrating.

I learned this by trying to instantiate the object and call its connect method only to find that the new connect method has 6 arguments instead of 5. Also, the new arguments are not the same as the old arguments. New method signature (per the DLL) is:

connect ( host, user, pass, datacenter, datstorepath, consoleflags)

I think the datacenter variable may be incorrectly named though, because I've had no luck getting this connect method to work.

There is a new method:

connectWithSession(host, ticket, moid, consoleflags)

I can't get this one to work either, although I've gotten closer. It always says my ticket is invalid (even though I just retrieved the ticket)

The console flags are:

1 = embedded

4 = fullscreen

16= hijack session

64= noconnect

8 = no MKS

2 = standalone

32= no VM MSG

The only one I've been able to get to yield a console window is 2 - standalone, but it errors out without connecting. It's also the only one that I've been able to get any meaningful error messages out of so I've stuck to it.

If you or anyone else knows how to get VMWare to update their KB, I think that's the best solution at this point.

0 Kudos
brreddy
Contributor
Contributor

Hi,

Was there any luck on this? I have the same problem. I am trying to connect virtual machine remote console with connectWithSession call. I am assuming this call expects 4 parameters - IP, ticket, moid and console-flags. Ticket is obtained using AcquireMKSTicket, moid is the VM id (for ex: 96) and console-flags for standalone I am passing 2. VMWare Remote Console launches and pops error message saying "Error opening the remote virtual machine 172.16.98.235\96:

Cannot complete login due to an incorrect user name or password.". But the ticket I got is latest. Please help.

- BRR

0 Kudos
epletsch
Contributor
Contributor

I have not yet had any luck. I shelved this part of the project temporarily. VMWare's examples are out of date and their new libraries are written in JScript and are impossible to decipher. As I've already spent 80+ hours learning everything I can and trying

everything I can with the DLL, at this point I've just got to move on until more information is available.

What would be really great is if they'd provide information on the

protocol, etc. so that someone could write an open source plugin. But

I think that will probably never happen.

I am hoping that they will rewrite their KB soon to provide a new, working example. with the version 2.5 plugin.

0 Kudos
brreddy
Contributor
Contributor

Good news. We were able to make it work. In connectWithSession call we

should not pass ticket that is acquired by AcquireMKSTicket. Instead, we

need to use AcquireCloneTicket call of session manager. This gives the

clone of current session's ticket. If we use this in connectWithSession

and mode as standalone it works.

0 Kudos
VIGuru
Contributor
Contributor

Excellent can u please email me an example script that I can test

0 Kudos
epletsch
Contributor
Contributor

Are you using the serviceContent Session Manager at the root of the VCenter MOB? Or, are you using a Session Manager from an individual host or from a virtual machine?

0 Kudos
brreddy
Contributor
Contributor

I am using serviceContent session manager of ESX server.

0 Kudos
epletsch
Contributor
Contributor

brreddy,

I'm back to this project again and trying to get my code modified to work based on what you said worked for you.

So, to clarify, you are calling:

connectWithSession(host, ticket, moid, consoleflags)

With host = your vcenter host

ticket = the ticket you got back from the vcenter acquireCloneTicket call

moid = the managed object id of the VM you're connecting to

consoleFlags = 2

Is that correct?

When I do that, I still get an invalid ticket error. I am wondering if I should be specifying the host of the physical server that the target VM is on or if I'm just missing something in my code.

Erich

0 Kudos
brreddy
Contributor
Contributor

That is correct. I am not using vcenter instead I am directly using the

ESX4 host. So try specifying host as physical server where your VM is

running.

0 Kudos
VIGuru
Contributor
Contributor

Hi guys can I do this with c# ?

0 Kudos
brreddy
Contributor
Contributor

Not sure, I am doing it in PHP.

0 Kudos
VIGuru
Contributor
Contributor

U use php to call the vsphere api?

0 Kudos
brreddy
Contributor
Contributor

Yes

0 Kudos
VIGuru
Contributor
Contributor

Could you give me an example using php to call vsphere api of an esx host to retrieve its version number?

0 Kudos
brreddy
Contributor
Contributor

It is not one file. I developed a library in PHP same as Java or .Net

SDK for vSphere API. Any app that I write uses this library.

0 Kudos
VIGuru
Contributor
Contributor

Where do I specify host instead of virtualcenter?

0 Kudos
epletsch
Contributor
Contributor

viguru,

I'm out of the office today but when I get back on Tuesday and get my code working I'll try to post an example of instantiating the plugin and connecting for you.

With regards to your questions about doing it in PHP or C#, that would best be a question for another thread as this thread is about the VMRC plugin.

Thanks,

Erich

0 Kudos