VMware Cloud Community
XServerCloud
Contributor
Contributor

Send keystroke to VM via API

Hello!

Does anyone know whether it's possible to send a keystroke like Ctrl+Alt+Del to the VM via an API (I'm using pyVmomi).

This feature is available in vCenter and host UI, as well as in the webMKS API. The latter is client-side JS API, but is there a way to do that using server-side API (pyVmomi for example)?

Reply
0 Kudos
2 Replies
XServerCloud
Contributor
Contributor

I found an answer myself. There is vm.PutUsbScanCodes method. Here is a python example.

MaxB
Enthusiast
Enthusiast

Not sure if helpful but i remember an old blogpost from lamw: https://williamlam.com/2017/09/automating-vm-keystrokes-using-the-vsphere-api-powercli.html

Think it sould be possible to translate it to python