pyvmomi-community-samples
pyvmomi-community-samples copied to clipboard
Sending keys to VM
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?
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
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.
Wondering if anyone knows how to simulate doing a keypress for X seconds with this though?