I need to take remote console of VM running on ESXi host. I need to take VNC for that purpose. To this to happen I need to assign TCP Port to each VM manually or programmatically (of course, by editing VMX file) using settings given below.
remotedisplay.vnc.port="5900"
remotedisplay.vnc.enabled="true"
remotedisplay.vnc.password = "yourpassword"
Is there any mechanism (preferrably psphere API) that I can tell ESX to assign port automatically for all machine or single machine for that matter?
Thanks & Regards,
Ganesh
PS. I'm using Ubuntu 14 and want to connect VMs via browser.
This is what I did to get it working using pysphere
>>> from pysphere import VIServer
>>> s = VIServer()
>>> s.connect('10.11.100.220', 'root', 'password')
>>> vm = s.get_vm_by_name("VMNAME")
>>> settings = {'remotedisplay.vnc.port': '8949', 'remotedisplay.vnc.enabled' : 'true'}
>>> vm.set_extra_config(settings)
>>> s.disconnect()