通过console可以实现类似远程桌面的功能,但它的实现方式和远程桌面不同,一般来说远程桌面必须要有网络支持,在机器关闭或者启动过程中无法连接。而console是通过esx的虚拟化组件实现远程桌面。在其sample代码中有一个用html+js编写ActiveX插件的示例。

下方是一个用winform写的console远程截图。

在vmware的developer center中https://developercenter.vmware.com/sdks,下载vmrc sdk,它会以com组件的形式安装,你可以在vs工具箱中找到。

下面上一段sample代码

 using System;
using System.Linq;
using System.Windows.Forms; using Vim25Api;
using AppUtil; namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public AppUtil.AppUtil util = null; public Form1()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
String[] arguments = new string[] {
"--url", "https://192.168.0.161/sdk",
"--username","root",
"--password","P@ssw0rd",
"--disablesso", "true",
"--ignorecert", "true"};
try
{
this.axVMwareEmbeddedRemoteConsole1.startup(, VMwareRemoteConsoleTypeLib.VMRC_MessageMode.VMRC_DIALOG_MESSAGES, null); util = AppUtil.AppUtil.initialize("Connect", constructOptions(), arguments.ToArray());
util.connect(); ManagedObjectReference mor = util.getConnection().ServiceRef;
ManagedObjectReference sessionMor = util._connection.Service.RetrieveServiceContent(mor).sessionManager;
string ticket = util._connection.Service.AcquireCloneTicket(sessionMor);
ManagedObjectReference vmMor = util.getServiceUtil().GetDecendentMoRef(null, "VirtualMachine", "test"); axVMwareEmbeddedRemoteConsole1.connect("192.168.0.161", null, true, ticket, null, null, vmMor.Value, null, null);
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString()); this.axVMwareEmbeddedRemoteConsole1.disconnect();
util.disConnect();
}
}
private static OptionSpec[] constructOptions()
{
OptionSpec[] useroptions = new OptionSpec[];
useroptions[] = new OptionSpec("url", "String", , "ser url", null);
useroptions[] = new OptionSpec("username", "String", , "user name", null);
useroptions[] = new OptionSpec("password", "String", , "password", null);
useroptions[] = new OptionSpec("disablesso", "bool", , "disablesso", null);
useroptions[] = new OptionSpec("ignorecert", "bool", , "ignorecert", null);
return useroptions;
} private void button2_Click(object sender, EventArgs e)
{
axVMwareEmbeddedRemoteConsole1.disconnect();
util.disConnect();
}
}
}

在建立connect连接时,有几个重要的参数

url为https://主机ip/sdk,登录帐号也是主机esx的帐号。

disablesso表示禁用sso单点登录验证,这个要加上,因为在我们远程登录验证不会使用sso。

ignorecert这个参数也要加上,不然会证书验证导致The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

这些参数如何运作可以到vsphere sdk中的apputil项目下找到。

vmware之VMware Remote Console (VMRC) SDK(一)的更多相关文章

  1. vmware之VMware Remote Console (VMRC) SDK(二)

    在上篇文章中,我们用winform结合vmware的api做了一个demo,在vmrc sdk中作为plugin单独打包出来vmware-vmrc-win32-x86.exe,上篇文章的demo只能基 ...

  2. vmware之VMware Remote Console (VMRC) SDK(三)

    前两节我们介绍了vmrc sdk的基本用法.在前面的demo中,有一个关键的问题是,我们现在所作的工作都是基于局域网的,作为应用层面上,主机不会直接暴露给用户,而是通过一系列的web service服 ...

  3. VMware实现控制台功能(VMware Remote Console)

    说明: 刚开始一脸懵逼,google了一些资料,发现基本没有能快速落地的,自己做完后梳理了一下发上来供大家参考. 如果帮到你了,请点赞评论关注,以资鼓励,多谢~ 实现VMware控制台功能主要有两种方 ...

  4. VMware vSphere Client5.0与 Windows8不再有问题,解决VMware 5.0 客户端提示VMRC控制台的连接已断开

    问题:VMware 5.0 客户端提示VMRC控制台的连接已断开...正在尝试重新连接,系统是win8的 网上解决办法: WIN8,在安装vmware vsphere client 5.0时出现兼容性 ...

  5. 通过IMM With Remote Console为服务器安装操作系统

    现有IBM System x3750 M4(8722A1C)配置   产品类别 机架式 产品结构 2U CPU类型 Intel 至强E5-4600 CPU型号 Xeon E5-4640 CPU频率 2 ...

  6. VMware workstation创建虚拟机console

    1. 使用VMware workstation创建虚拟机硬件2. 安装操作系统3. 操作系统安装过程 1. 使用VMware workstation创建虚拟机硬件 使用VMware workstati ...

  7. VMware workstation创建虚拟机console图文

    1. 概述2. 配置入口3. 新建虚拟机向导3.1 类型配置3.2 硬件兼容性3.3 操作系统安装3.4 客户机操作系统类型3.5 客户机的名称位置4. 客户机硬件配置选择4.1 客户机处理器配置4. ...

  8. vmware开发包之vSphere Management SDK

    vSphere Management SDK关于vmware管理等相关功能的.net和java的代码示例. 在其5.5的解压包中 eam:esx agent management表示esx虚机生产环境 ...

  9. VMware vCenter重置web console SSO登录密码

    On a Windows Platform Services Controller or vCenter Server with Embedded Platform Services Controll ...

随机推荐

  1. [z]IE6各种不兼容问题

    http://blqw1.diandian.com/post/2012-01-12/16137399 http://www.cnblogs.com/qiangspecial/archive/2013/ ...

  2. leetcode575

    public class Solution { public int DistributeCandies(int[] candies) { var dic = new Dictionary<in ...

  3. leetcode515

    /** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNo ...

  4. jQuery自动触发事件

    转自:https://blog.csdn.net/CY_LH/article/details/78982218 常用模拟 有时候,需要通过模拟用户操作,来达到单击的效果.例如在用户进入页面后,就触发c ...

  5. i++的原子性问题

    一.什么是原子性 简单的可以理解为:操作是不可再分割的,比如: int i=0; 但是i++的操作是可以再分的,比如: i++ //分解后 i=i+i 上面的代码在多线程环境下取值是有问题的,比如: ...

  6. JAVA压缩 解压缩zip 并解决linux下中文乱码

    1. [代码][Java]代码   1:再压缩前,要设置linux模式, 需要使用第三方ant-1.6.5.jar  如果是文件目录,则ZipEntry zipEntry=new ZipEntry(b ...

  7. VS2008调用VS2012的WCF服务的方式和遇到的问题

    1 用添加服务引用的懒方式 2 用http请求方式 3 客户端自己定义一个Contract,跟服务端的一样(可以只写要使用的方法,不用全部写完). 由于规范要求,前两种都不能用,后面根据同事的描述,产 ...

  8. Java的SSH网站

    1.框架 strusts2 + Hibernate + spring 2.图片 图1-1 网站结构 图1-2 java代码结构 3.源代码 3.1 UserAction.java package co ...

  9. MySQL数据库篇之索引原理与慢查询优化之一

    主要内容: 一.索引的介绍 二.索引的原理 三.索引的数据结构 四.聚集索引与辅助索引 五.MySQL索引管理 六.测试索引 七.正确使用索引 八.联合索引与覆盖索引 九.查询优化神器--explai ...

  10. iPhone与Android手机 各个型号的UserAgent

    摘要:userAgent 属性是一个只读的字符串,声明了浏览器用于 HTTP 请求的用户代理头的值.一般来讲,它是在navigator.appCodeName 的值之后加上斜线和navigator.a ...