VMware Remote Console 使用

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

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

1

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

下面上一段sample代码

复制代码

11 using System; 2 2 using System.Linq; 3 3 using System.Windows.Forms; 4 4 5 5 using Vim25Api; 6 6 using AppUtil; 7 7 8 8 namespace WindowsFormsApplication1 9 9 { 1010 public partial class Form1 : Form 1111 { 1212 public AppUtil.AppUtil util = null; 1313 1414 public Form1() 1515 { 1616 InitializeComponent(); 1717 } 1818 1919 private void button1_Click(object sender, EventArgs e) 2020 { 2121 String[] arguments = new string[] { 2222 "--url", "https://192.168.0.161/sdk", 2323 "--username","root", 2424 "--password","P@ssw0rd", 2525 "--disablesso", "true", 2626 "--ignorecert", "true"}; 2727 try 2828 { 2929 this.axVMwareEmbeddedRemoteConsole1.startup(2, VMwareRemoteConsoleTypeLib.VMRC_MessageMode.VMRC_DIALOG_MESSAGES, null); 3030 3131 util = AppUtil.AppUtil.initialize("Connect", constructOptions(), arguments.ToArray()); 3232 util.connect(); 3333 3434 ManagedObjectReference mor = util.getConnection().ServiceRef; 3535 ManagedObjectReference sessionMor = util._connection.Service.RetrieveServiceContent(mor).sessionManager; 3636 string ticket = util._connection.Service.AcquireCloneTicket(sessionMor); 3737 ManagedObjectReference vmMor = util.getServiceUtil().GetDecendentMoRef(null, "VirtualMachine", "test"); 3838 3939 axVMwareEmbeddedRemoteConsole1.connect("192.168.0.161", null, true, ticket, null, null, vmMor.Value, null, null); 4040 } 4141 catch(Exception ex) 4242 { 4343 MessageBox.Show(ex.ToString()); 4444 4545 this.axVMwareEmbeddedRemoteConsole1.disconnect(); 4646 util.disConnect(); 4747 } 4848 } 4949 private static OptionSpec[] constructOptions() 5050 { 5151 OptionSpec[] useroptions = new OptionSpec[5]; 5252 useroptions[0] = new OptionSpec("url", "String", 1, "ser url", null); 5353 useroptions[1] = new OptionSpec("username", "String", 1, "user name", null); 5454 useroptions[2] = new OptionSpec("password", "String", 1, "password", null); 5555 useroptions[3] = new OptionSpec("disablesso", "bool", 0, "disablesso", null); 5656 useroptions[4] = new OptionSpec("ignorecert", "bool", 1, "ignorecert", null); 5757 return useroptions; 5858 } 5959 6060 private void button2_Click(object sender, EventArgs e) 6161 { 6262 axVMwareEmbeddedRemoteConsole1.disconnect(); 6363 util.disConnect(); 6464 } 6565 } 6666 }

复制代码

在建立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项目下找到。

参考:http://www.cnblogs.com/yuefei/p/3615785.html

点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

一篇文章带你了解JavaScript日期

日期对象允许您使用日期(年、月、日、小时、分钟、秒和毫秒)。一、JavaScript的日期格式一个JavaScript日期可以写为一个字符串:ThuFeb02201909:59:51GMT0800(中国标准时间)或者是一个数字:1486000791164写数字的日期,指定的毫秒数自1970年1月1日00:00:00到现在。1\.显示日期使用