开发者

Automate Virtual Machine

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 开发者_如何学JAVA= 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)


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜