自动化虚拟机
我正在开发一个类似于 Mircosoft Virtual Lab 的项目。我创建了一个 .aspx (C#) 网页,该网页能够运行 powershell 脚本来启动 vmware-vmrc 控制台。该网页已部署并在我自己的计算机上运行。我还尝试在服务器中发布我的解决方案,网页运行良好,但控制台没有出现在我的屏幕上。我猜是因为脚本运行在服务器上而不是本地主机上。我想知道如果我的解决方案/程序是在服务器中构建的,是否有任何方法可以启动控制台。
$hostname = "localhost:8333"
$vms = "VmName"
$vm = get-vm $vms
$vmid = $vm.id
$gvm = Get-View $vmid
$vmrc = "C:\Program Files (x86)\Common Files\VMware\VMware Remote Console Plug-in\vmware-vmrc.exe"
$vmrcargs = '-h ' + $hostname + ' -m "' + $gvm.Config.Files.VmPathName + '"'
[Diagnostics.Process]::Start($vmrc, $vmrcargs)
I am working on a project that is similiar to Mircosoft Virtual Lab. I have created a .aspx (C#) webpage that is able to run powershell script to launch vmware-vmrc console. The webpage is deployed and run on my own computer. I also have try to publish my solution in a server, webpage work well but console do not appear on my screen. I guess it because the script is running on the server instead of the localhost. I will like to know is there any way to launch the console if my solution/programme is build in the server.
$hostname = "localhost:8333"
$vms = "VmName"
$vm = get-vm $vms
$vmid = $vm.id
$gvm = Get-View $vmid
$vmrc = "C:\Program Files (x86)\Common Files\VMware\VMware Remote Console Plug-in\vmware-vmrc.exe"
$vmrcargs = '-h ' + $hostname + ' -m "' + $gvm.Config.Files.VmPathName + '"'
[Diagnostics.Process]::Start($vmrc, $vmrcargs)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在您的代码中,您将主机名硬编码为 localhost,理论上您可以从 ASP.NET 上下文的 Request 对象中读取该值,并将其替换为客户端的主机名。
这么说,我真的怀疑它是否会起作用,因为服务器没有被授予远程访问客户端的权限......即使传递正确的IP地址,即使我看到指定了一个端口(8333),也可能有防火墙 当然,
在内联网中它可以工作,你必须尝试一下。
in your code you have the hostname hard coded as localhost, in theory you could read this value from the Request object of ASP.NET context and replace it with the client's host name.
Said so, I really doubt it would work because it's not granted that the server has access to the client remotely... even passing proper IP address, and even if I see there is a port specified (8333), there could be firewalls in the between...
of course in an intranet it could work, you have to try this out.
通过端口 8333 对客户端名称执行 telnet,检查端口是否开放。
如果 telnet 有效,则将“localhost(或 dns 或主机名)替换为客户端的 IP”。
如果 telnet 无效,则打开端口。
但是,如果端口打开,它就会工作。
亲切的问候,
加里什
Perform a telnet on the client's name via the port 8333 to check if the port is open.
If the telnet works, then replace "localhost(or dns or Host name) with the IP of the client"
If the the telnet does not work, then open the port.
However if the port is open, it will work.
Kind Regards,
Garish