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代码
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(一)的更多相关文章
- vmware之VMware Remote Console (VMRC) SDK(二)
在上篇文章中,我们用winform结合vmware的api做了一个demo,在vmrc sdk中作为plugin单独打包出来vmware-vmrc-win32-x86.exe,上篇文章的demo只能基 ...
- vmware之VMware Remote Console (VMRC) SDK(三)
前两节我们介绍了vmrc sdk的基本用法.在前面的demo中,有一个关键的问题是,我们现在所作的工作都是基于局域网的,作为应用层面上,主机不会直接暴露给用户,而是通过一系列的web service服 ...
- VMware实现控制台功能(VMware Remote Console)
说明: 刚开始一脸懵逼,google了一些资料,发现基本没有能快速落地的,自己做完后梳理了一下发上来供大家参考. 如果帮到你了,请点赞评论关注,以资鼓励,多谢~ 实现VMware控制台功能主要有两种方 ...
- VMware vSphere Client5.0与 Windows8不再有问题,解决VMware 5.0 客户端提示VMRC控制台的连接已断开
问题:VMware 5.0 客户端提示VMRC控制台的连接已断开...正在尝试重新连接,系统是win8的 网上解决办法: WIN8,在安装vmware vsphere client 5.0时出现兼容性 ...
- 通过IMM With Remote Console为服务器安装操作系统
现有IBM System x3750 M4(8722A1C)配置 产品类别 机架式 产品结构 2U CPU类型 Intel 至强E5-4600 CPU型号 Xeon E5-4640 CPU频率 2 ...
- VMware workstation创建虚拟机console
1. 使用VMware workstation创建虚拟机硬件2. 安装操作系统3. 操作系统安装过程 1. 使用VMware workstation创建虚拟机硬件 使用VMware workstati ...
- VMware workstation创建虚拟机console图文
1. 概述2. 配置入口3. 新建虚拟机向导3.1 类型配置3.2 硬件兼容性3.3 操作系统安装3.4 客户机操作系统类型3.5 客户机的名称位置4. 客户机硬件配置选择4.1 客户机处理器配置4. ...
- vmware开发包之vSphere Management SDK
vSphere Management SDK关于vmware管理等相关功能的.net和java的代码示例. 在其5.5的解压包中 eam:esx agent management表示esx虚机生产环境 ...
- VMware vCenter重置web console SSO登录密码
On a Windows Platform Services Controller or vCenter Server with Embedded Platform Services Controll ...
随机推荐
- REST 规范
DRF之REST规范介绍及View请求流程分析 DRF之解析器组件及序列化组件 DRF - 序列化组件(GET/PUT/DELETE接口设计).视图优化组件 DRF之权限认证频率组件 DRF之注册器响 ...
- swagger 接口文档,控制器 和 object类型的参数与返回值 的 注释不显示问题
一.控制器的注释不显示:是因为配置swagger的时候没有将includeControllerXmlComments参数配置为true,因为其默认值为false 二.object 类型的参数和返回值 ...
- 「小程序JAVA实战」java-sesion的状态会话与无状态会话(38)
转自:https://idig8.com/2018/09/02/xiaochengxujavashizhanjava-sesiondezhuangtaihuihuayuwuzhuangtaihuihu ...
- 「小程序JAVA实战」小程序页面引用外部wxml通用页面(21)
转自:https://idig8.com/2018/08/09/xiaochengxu-chuji-21/ 现在都是讲究开发的效率,原来单纯的android 和 ios 已经不在吃香了,都是混合开发, ...
- 查看端口占用情况lsof,并关闭对应进程kill
lsof -n -P| grep ":<端口号>" | grep LISTEN #监听对应端口号的进程 lsof -i tcp:<端口号> #和对应端口号有 ...
- Flying Right POJ - 3038
有一条从南到北的航线,航线上有N个机场1-n从南到北分布,每天早上飞机从1飞到n,傍晚从n飞到1.有k组乘客,他们数量为M[k],从S飞到E,飞机上只有C个座位,计算每天飞机最多能拉多少乘客 贪心可以 ...
- java反射对实体类取值和赋值,可以写成通过实体类获取其他元素的数据,很方便哦~~~
项目中需要过滤前面表单页面中传过来的实体类的中的String类型变量的前后空格过滤,由于前几天看过一个其他技术博客的的java反射讲解,非常受益.于是,哈哈哈 public static <T& ...
- 本地SQL查询
-------------------siwuxie095 本地 SQL 查询 1.简单介绍 采用 HQL 或 QBC 查询时,Hibernate 生成标准的 SQL 语句, 适用于所有的数据库平台, ...
- 68. Text Justification一行单词 两端对齐
[抄题]: Given an array of words and a width maxWidth, format the text such that each line has exactly ...
- 256. Paint House房屋染色
[抄题]: There are a row of n houses, each house can be painted with one of the three colors: red, blue ...