通过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. 第六篇 Flask 中内置的 Session

    Flask中的Session非常的奇怪,他会将你的SessionID存放在客户端的Cookie中,使用起来也非常的奇怪 1. Flask 中 session 是需要 secret_key 的 from ...

  2. leetcode289

    public class Solution { public void GameOfLife(int[][] board) { ) - ; ].GetLength() - ; var list = n ...

  3. leetcode703

    class KthLargest { public: KthLargest(int k, vector<int> nums) { size = k; for(auto num:nums){ ...

  4. SpringData JPA示例

    SpringData JPA只是SpringData中的一个子模块 JPA是一套标准接口,而Hibernate是JPA的实现 SpringData JPA 底层默认实现是使用Hibernate 1.  ...

  5. ActionMQ5.8.0 JMS实例 手把手详细图解

    出自:http://blog.csdn.net/tongjie008/article/details/40687087 ActionMQ 是开源的JMS实现 1.下载ActiveMQ 去官方网站下载: ...

  6. aop编程术语

  7. python's metaclass

    [python's metaclass] 和objc中类似,metaclass用于创建一个类对象,但与objc不同的是,objc中每个类对象有各自不同的metaclass,而python中的metac ...

  8. Unity游戏语音(富文本消息)解决方案GVoice

    腾迅云-GVoice https://www.qcloud.com/document/product/556/7673 集成1-2天内可搞定,博主亲测 Unity5.4.4f1 今天又试了下语音转文字 ...

  9. Hibernate入门级实例

    一.开发环境 Win8 + jdk1.7 + MyEclipse + Tomcat5.0 + MySQL 说明:其实Hibernate是非常独立的框架,根本不需要MyEclipse,Eclipse,T ...

  10. MongoDB 那些坑

    MongoDB 是目前炙手可热的 NoSQL 文档型数据库,它提供的一些特性很棒:如自动 failover 机制,自动 sharding,无模式 schemaless,大部分情况下性能也很棒.但是薄荷 ...