vmware之VMware Remote Console (VMRC) SDK(一)
通过console可以实现类似远程桌面的功能,但它的实现方式和远程桌面不同,一般来说远程桌面必须要有网络支持,在机器关闭或者启动过程中无法连接。而console是通过esx的虚拟化组件实现远程桌面。在其sample代码中有一个用html+js编写ActiveX插件的示例。
下方是一个用winform写的console远程截图。
在vmware的developer center中https://developercenter.vmware.com/sdks,下载vmrc sdk,它会以com组件的形式安装,你可以在vs工具箱中找到。
下面上一段sample代码
1 usingSystem;2 usingSystem.Linq;3 usingSystem.Windows.Forms;4 5 usingVim25Api;6 usingAppUtil;7 8 namespaceWindowsFormsApplication19 {10 public partial classForm1 : Form11 {12 public AppUtil.AppUtil util = null;13 14 publicForm1()15 {16 InitializeComponent();17 }18 19 private void button1_Click(objectsender, EventArgs e)20 {21 String[] arguments = new string[] {22 "--url", "https://192.168.0.161/sdk",23 "--username","root",24 "--password","P@ssw0rd",25 "--disablesso", "true",26 "--ignorecert", "true"};27 try 28 {29 this.axVMwareEmbeddedRemoteConsole1.startup(2, VMwareRemoteConsoleTypeLib.VMRC_MessageMode.VMRC_DIALOG_MESSAGES, null);30 31 util = AppUtil.AppUtil.initialize("Connect", constructOptions(), arguments.ToArray());32 util.connect();33 34 ManagedObjectReference mor =util.getConnection().ServiceRef;35 ManagedObjectReference sessionMor =util._connection.Service.RetrieveServiceContent(mor).sessionManager;36 string ticket =util._connection.Service.AcquireCloneTicket(sessionMor);37 ManagedObjectReference vmMor = util.getServiceUtil().GetDecendentMoRef(null, "VirtualMachine", "test");38 39 axVMwareEmbeddedRemoteConsole1.connect("192.168.0.161", null, true, ticket, null, null, vmMor.Value, null, null);40 }41 catch(Exception ex)42 {43 MessageBox.Show(ex.ToString());44 45 this.axVMwareEmbeddedRemoteConsole1.disconnect();46 util.disConnect();47 }48 }49 private staticOptionSpec[] constructOptions()50 {51 OptionSpec[] useroptions = new OptionSpec[5];52 useroptions[0] = new OptionSpec("url", "String", 1, "ser url", null);53 useroptions[1] = new OptionSpec("username", "String", 1, "user name", null);54 useroptions[2] = new OptionSpec("password", "String", 1, "password", null);55 useroptions[3] = new OptionSpec("disablesso", "bool", 0, "disablesso", null);56 useroptions[4] = new OptionSpec("ignorecert", "bool", 1, "ignorecert", null);57 returnuseroptions;58 }59 60 private void button2_Click(objectsender, EventArgs e)61 {62 axVMwareEmbeddedRemoteConsole1.disconnect();63 util.disConnect();64 }65 }66 }
在建立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项目下找到。
转载于:https://www.cnblogs.com/yuefei/p/3615785.html
vmware之VMware Remote Console (VMRC) SDK(一)相关推荐
- VMware vSphere Client5.0与 Windows8不再有问题,解决VMware 5.0 客户端提示VMRC控制台的连接已断开...
问题:VMware 5.0 客户端提示VMRC控制台的连接已断开...正在尝试重新连接,系统是win8的 网上解决办法: WIN8,在安装vmware vsphere client 5.0时出现兼容性 ...
- 安装 VMWare及VMware下创建的虚拟PC机安装Linux操作系统
安装 VMWare及VMware下创建的虚拟PC机安装Linux操作系统 做Linux操作系统实验,学校发的指导文档辣么长,还没图(ಥ_ಥ),在网上找到了个超详细的视频分享一下,也供自己复习使用. 链 ...
- VMware公司MKS连接Remote Console
VMware 公司的MKS客户端 该项目是断开所有CD从所有与一键点击虚拟机的完成,所以我想这是一个新项目的时间..让我们构建一个VDI的连接代理与嵌入式XP的虚拟机控制台. 我首先需要做的是弄清楚如 ...
- vmware开发包之vSphere Management SDK
原文地址:http://www.cnblogs.com/yuefei/p/3600441.html 原文写的挺好的,我这里增加了一些细节.来帮助像我这样的小白,明明按照说明来,可还是不对 准备: vS ...
- 嵌入式Linux教程:安装VMware Tools VMware Tools显示灰色解决方法
VMware Tools功能 VMware Tools 中包含一系列服务和模块,可在 VMware 产品中实现多种功能,从而使用户能够更好地管理客户机操作系统,以及与客户机系统进行无缝交互. 例如,V ...
- 玩转虚拟化VMWare之一: VMWare ESXi 5.0和vSphere Client安装和配置
内容提要: 1. 安装和配置VMWare ESXi 5.0 2. 安装和配置vSphere Client 3. 详细介绍如何注册 4. 如何在ESXi 5.0中安装CentOS 6.4 x64 一.E ...
- VMware虚拟机VMware Authorization Service不能启动问题
出现VMware Authorization Service不能启动问题,注意要在安装VMware Player时使用管理员权限 转载于:https://www.cnblogs.com/mingzha ...
- VMware, Inc.VMware VUE考试中心代码
VMware, Inc. 考试代码 考试科目名称 时间 考试中心 1V0-621 VMware Certified Associate 6 - Data Center Virtualization F ...
- 【Linux】VMware安装VMware Tools工具
VMware Tools是VMware虚拟机中自带的一种增强工具,相当于VirtualBox中的增强功能(Sun VirtualBox Guest Additions),是VMware提供的增强虚拟显 ...
- 【VMware】VMware虚拟机与主机之间文件共享配置
以win11主机与win7虚拟机为例 WIN11下操作 虚拟机WIN7下操作 WIN11下操作 1. 安装的VMware虚拟机的网络设置为桥接模式 2.在本地主机创建一个共享文件夹,命名如share ...
最新文章
- js左侧三级菜单导航代码
- 【POJ1509】Glass Beads 【后缀自动机】
- 正则表达式的坑与调试
- python【蓝桥杯vip练习题库】ADV-172身份证排序
- ontological 词根词缀_英语中最常见的词缀(一)之 re
- What you should do if you want to become more professional in career?
- android wtf_WTF连接池
- Oracle中如何判断字符串是否全为数字
- Git安装教程(windows)
- xml文件导入wps_Office12使用XML格式存储文件回击WPS
- 定投计算器和年化利率计算器
- 计算机word表格ppt,计算机应用基础-04-WORD表格.ppt
- 19 年 3 月 GitHub 上最流行的 34 个 JS 仓库
- Jetson Xavier NX——重新刷系统
- 获奖结果公布|2020腾讯犀牛鸟云开发校园技术布道师养成计划
- 大学英语六级考试大纲 A
- Vue3究竟好在哪里?
- rdkit 分子性质描述符(Descriptors)
- 一次面试苏宁java开发的经历
- c++ unescape