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 ...
随机推荐
- Selinux相关
SELinux相关的工具 /usr/bin/setenforce 修改SELinux的实时运行模式 setenforce 1 设置SELinux 成为enforcing模式 setenforce 0 ...
- 【转】iphone - ios app maximum memory budget
https://stackoverflow.com/questions/5887248/ios-app-maximum-memory-budget device: (crash amount/tota ...
- Lnmp 源码编译安装、常见错误整理
简介: Lnmp 环境的搭建还是非常简单的,之前由于博客迁移等原因,导致丢失了好多博文,这次重新整理记录一下. Lnmp 即:Linux .Nginx .Mysql .PHP Lnmp 是一套 Web ...
- Linux ALSA声卡驱动之一:ALSA架构简介
声明:本博内容均由http://blog.csdn.net/droidphone原创,转载请注明出处,谢谢! 一. 概述 ALSA是Advanced Linux Sound Architecture ...
- shell编程——sed用法之参数详解
sed格式: sed 参数 '正则表达式' 文件名 sed的常见参数有以下几种: 1.-n, --quiet, --silent 取消自动打印模式 不加n默认打印整个文件: [root@localho ...
- struts2 action重定向action中文乱码处理
比如:Action方法productCategorySave()变量message,传递给Action方法productCategoryAdd(),当变量message为中文变量时,要进行编码设置,不 ...
- 微信小程序相关三、css写小黄人
小程序上课第三天,因为今天院里有活动,所以没去上课,第四天上午又因为要召开入党转正大会,又耽误了一上午,下午去上课,要了资料.这两天讲了一些零零碎碎的东西,做的实例有上面这个小黄人 都是用的css,基 ...
- sax解析xml文件,封装到对象中
创建User.java类 public class User { private String id; private String name; private String age; private ...
- golang怎么使用redis,最基础的有效的方法
最近在学GO语言,我自己也喜欢使用redis,于是乎就顺便把go操作redis的方法也给学了,有个第三方包,在GitHub上面找的 go get github.com/alphazero/Go-Red ...
- MAC命令大全
OSX 的文件系统 OSX 采用的Unix文件系统,所有文件都挂在跟目录 / 下面,所以不在要有Windows 下的盘符概念. 你在桌面上看到的硬盘都挂在 /Volumes 下. 比如接上个叫做 ...