• Skip to site navigation
  • Skip to blog entries
  • Skip to archive page
  • Skip to right sidebar

VMware MKS client (step one)

Eric Sloof - NTPRO.NL

  • NTPRO.NL
  • Online Training
  • VMworld
  • Videos
  • Tools
  • iTunes
  • About

Tuesday, 19 June 2007

VMware MKS client (step one)

The project to disconnect all the CD’s from all the VM’s with one click of a button is finished so I thought it’s time for a new project. Let’s build a VDI connection broker with an embedded console for the XP VM’s. The first thing I needed to do is figure out how I could embed a console view into my VB application. After some searching in the VMware forums I ended up with one or two posts that weren’t much of a help. I decided to take a closer look at the console that is used in web access.  When you logon to web access and select a VM, you can get a console in your Internet Explorer. Let’s find out what happens in the background. Log on to Web Access : https://vcserver/ui

Select a virtual machine and click the console tab. Go to your Temporary Internet Files folder (C:\Documents and Settings\Eric\Local Settings\Temporary Internet Files) and look for a recent file with the name vmTabView[1].htm. Copy the vmTabView[1].htm to your desktop and open it in notepad. Scroll down to the following line :

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

What you see is the link to the ActiveX object we all use when we open a console to a virtual machine. What I did next is search the forums for the CLSID and after a  while I found an article about someone who tries to do the same as us. This person added some additional lines he received from VMware.

<script language="Javascript" type="text/javascript">
// hostAddress -> ESX host name (fqdn) or the IP address.
// authdPort -> 902 (please make sure port 902 and 903 are open) .
// vmCfgPath -> The VMX location (for the VM in question) .
// uname -> A valid user name.
// password -> A valid password.
mks.connect(esxserver, 902, /vmfs/volumes/45783090-7ae6a1d6-eaed-001185e85a6b/virtual.vmx, uname,  password);
</script>

How do we get all this information and what can we use as username and password ? The answer is : The MOB is your friend. Open an Internet Explorer and go to the MOB https://vcserver/mob. Log on with your Windows credentials and navigate to the following path. RetrieveServiceContent / Invoke Method / rootFolder / childEntity / vmFolder /.
Select a VM (not a template) and go to the bottom of the screen where you will find  VirtualMachineMksTicket. When you invoke the AcquireMksTicket method you will see all the answers you need.

cfgFile

string

"/vmfs/volumes/455ab25f-5b192a18-8911-0019bb240e8a/ VirtualMachine/VirtualMachine.vmx"

dynamicProperty

DynamicProperty[]

Unset

dynamicType

string

Unset

host

string

"192.168.1.1"

port

int

902

ticket

string

"52c75705-6cea-4837-4ecb-1120ceda692e"

The ticket is the username and password for your new webpage it will stay the same until you invoke it again but you can retrieve these values from within your VB code just before you launch your embedded Active X control. Here is our new HTML file.

<object id="mks" classid="CLSID:DC7D77DA-E1AC-4D40-930B-B87B2954E034" codebase='https://vcserver/ui/plugin/msie/vmware-mks.cab#version=2,0,1,0' width="100%" height="100%">  </object>
<script language="Javascript" type="text/javascript">
mks.connect(
192.168.1.1, 902, /vmfs/volumes/455ab25f-5b192a18-8911-0019bb240e8a/ VirtualMachine/VirtualMachine.vmx, 52c75705-6cea-4837-4ecb-1120ceda692e,  52c75705-6cea-4837-4ecb-1120ceda692e
);
</script>

When you open this page in your Internet Explorer you could assume that you will see the console of your VM but you will end up with a black box. I don’t know why it doesn’t work but maybe you can help me out ?

Update : 21-06-2007

I created a new VB project.

I made a copy of \\vcserver\c$\Program Files\VMware\VMware VirtualCenter
2.0\tomcat\webapps\ui\plugin\msie\vmware-mks.cab and placed the dll and exe file in my
project directory.

I added quickMksAx.dll as a reference to my application and wrote the following code:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
        Dim test As New QuickMksAxLib.QuickMksAxCtl

        MsgBox(test.Connect("192.168.10.10", 902,
"/vmfs/volumes/45783090-7ae6a1d6-eaed-001185e85a6b/nl-nwg-a57/nl-nwg-a57.vmx",
"528364d0-6146-52fe-144c-085e1f7b4f76", "528364d0-6146-52fe-144c-085e1f7b4f76"))

        test.SendCAD()
    End Sub

I generated the parameters with the MOB bit I know I can do it with the VB application
itself.

I get a true response back ? The only thing I don?t know is how I can embed the
vmware-remotemks.exe for the actual screen. What I did instead is add a WebBrowser box
with the following URL test.html witch contains

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

Posted by
Eric Sloof
in VM MKS Client at 21:17 | 2 Trackbacks
Bookmark and Share
Trackbacks
Trackback specific URI for this entry
VMware MKS client
A few weeks ago I started building a VMware MKS client aka VDI connection broker with an integrated VM console. I got stranded at the point that I was staring at a black screen until Bouke Groenescheij showed up. We have teamed up for a few moths and ar
Weblog: NTPRO.NL
Tracked: Jul 12, 15:12
VMware MKS client
A few weeks ago I started building a VMware MKS client with an integrated VM console. I got stranded at the point that I was staring at a black screen until Bouke Groenescheij showed up. We have teamed up for a few moths and are working together at Ahrend
Weblog: NTPRO.NL
Tracked: Jul 16, 20:57
Comments
Display comments as (Linear | Threaded)
No comments
The author does not allow comments to this entry


Twitter RSS FeedLinkedIn

www.hetesambal.nl

Veeam Webinar with Doug Hazelman: 5 Steps to Successful Backup & Replication for Hyper-V! Watch it now >>

Recent Entries

White Paper - Mobility and Disaster Recovery Solution for Virtualized Tier-1 Enterprise Applications
Saturday, January 21 2012
Video - Install vSphere Syslog Collector and configure ESXi logging
Friday, January 20 2012
Storage Design and Implementation in vSphere 5.0 - The Rough Cuts
Thursday, January 19 2012
Top 25 Free Tools for VMware vSphere presented by David Davis and Kendrick Coleman
Monday, January 16 2012
LG Android running VMware Horizon Mobile hands-on
Saturday, January 14 2012
Forbes Guthrie has released the vSphere 5 vReference Card
Thursday, January 12 2012
VMworld Session - VMware vMotion in VMware vSphere 5: Architecture, Performance & Best Practices
Wednesday, January 11 2012
Voice Over IP (VoIP) Performance Evaluation on VMware vSphere 5.0
Tuesday, January 10 2012
VMware vCloud Director 1.5 Performance and Best Practices
Monday, January 9 2012
VMware vCenter Site Recovery Manager 5.0 Performance and Best Practices
Sunday, January 8 2012

Archive

  • February 2012 (6)
  • January 2012 (22)
  • December 2011 (21)
  • November 2011 (24)
  • October 2011 (27)
  • September 2011 (26)
  • August 2011 (35)
  • July 2011 (26)
  • June 2011 (15)
  • May 2011 (20)
  • April 2011 (22)
  • March 2011 (22)
  • February 2011 (18)
  • January 2011 (13)
  • December 2010 (23)
  • November 2010 (18)
  • October 2010 (31)
  • September 2010 (22)
  • August 2010 (23)
  • July 2010 (19)
  • June 2010 (19)
  • May 2010 (19)
  • April 2010 (20)
  • March 2010 (23)
  • February 2010 (22)
  • January 2010 (30)
  • December 2009 (37)
  • November 2009 (29)
  • October 2009 (27)
  • September 2009 (36)
  • August 2009 (35)
  • July 2009 (35)
  • June 2009 (43)
  • May 2009 (35)
  • April 2009 (56)
  • March 2009 (51)
  • February 2009 (69)
  • January 2009 (69)
  • December 2008 (60)
  • November 2008 (56)
  • October 2008 (49)
  • September 2008 (63)
  • August 2008 (44)
  • July 2008 (54)
  • June 2008 (26)
  • May 2008 (34)
  • April 2008 (27)
  • March 2008 (38)
  • February 2008 (29)
  • January 2008 (35)
  • December 2007 (24)
  • November 2007 (23)
  • October 2007 (20)
  • September 2007 (54)
  • August 2007 (15)
  • July 2007 (22)
  • June 2007 (13)
  • May 2007 (8)
  • April 2007 (20)
  • March 2007 (10)
  • Recent...
  • Older...
Based on the s9y Bulletproof template framework
Powered by s9y – Template by Bulletproof development team.
  • NTPRO.NL
  • Online Training
  • VMworld
  • Videos
  • Tools
  • iTunes
  • About