pyvmomi-community-samples icon indicating copy to clipboard operation
pyvmomi-community-samples copied to clipboard

Sending keys to VM

Open ciscomonkey opened this issue 6 years ago • 3 comments

I'm not finding anything in the pyvmomi documentation on sending keystrokes to a VM. In powerCLI this can be done using the Set-VMKeystrokes to send keypresses to the vm itself. Is there an example on how to do this using pyvmomi? Or has that functionality even made it into pyvmomi?

ciscomonkey avatar Dec 06 '18 15:12 ciscomonkey

The functionality is there as VirtualMachine.PutUsbScanCodes() As far as examples, I can only find: http://key-value.blogspot.com/2017/11/vmware-keystroke-based-automation.html using it in python. The logic between PowerCLI should mostly translate the same though in which case I like this example: https://www.virtuallyghetto.com/2017/09/automating-vm-keystrokes-using-the-vsphere-api-powercli.html

prziborowski avatar Dec 06 '18 18:12 prziborowski

Thanks. I have been using the virtually ghetto one for a while. Can't believe i haven't found that link before for the pythonic version.

ciscomonkey avatar Dec 06 '18 20:12 ciscomonkey

Wondering if anyone knows how to simulate doing a keypress for X seconds with this though?

ciscomonkey avatar Dec 06 '18 21:12 ciscomonkey