VMware Communities
griefman
Contributor
Contributor

VMware Workstation 14 Pro cannot recognize automated mouse clicks and key strokes sent to the host

Hi everyone,

on a Windows 10 machine i am trying send automated mouse clicks and key strokes to a vm in VMware Workstation 14 Pro(14.1.1-7528167). I use AutoIt for the automation. This is usually a mouse click sent in the VM, or a key combination, to grab the input and then send something. I need this because the software which i am testing does not entirely operate in a system, where i can rely on an automation solution inside the VM. I tried using many different ways and frameworks - not only AutoIt - to send a mouse click or a hotkey to the VM, however i am never able to do it. For some reason, the automation is executed, but there is no effect on the VM. If i do not focus the VMware window and just tell my script to make a mouse click at given coordinates(absolute to the host), which then will match a point inside the VM, the mouse pointer will move towards the coordinates and the click will be sent, but there will be no reaction from the vm - the focus will not be grabbed. If i focus my VM first and then send the mouse click, the mouse wont even move towards the coordinates. Same goes for the keyboard i am not even able to send Ctrl+g to grab the focus. I can only grab the focus if i send hotkey to navigate through the menu and select the option from there. Afterwards however i cant do anything more. AutoIt uses the WInAPI to send mouse click and keystroke events.I guess so does every other automation solution, which i tried. I spend a lot of time trying things out. Among them were trying all kinds of options for configuring grabing the focus, transferring the clipboard, etc also not using the enhanced keyboard driver, but only downgrading to workstation 12 made it work. Could you make look into that? There has apparently been a change to how VMware Workstation 14 Pro works with input with regards to workstation 12.

I would appreciate it very much, if you could help me figure this out!

Best

0 Kudos
7 Replies
wila
Immortal
Immortal

Hi,

For security reasons, what you are trying to do is not supposed to work.

VMware will NOT fix this as it "works as designed".

If you want to automate VMware workstation then you should be looking into VMware VIX and vmrun and not the hacky things that involve sending mouse clicks and automated keyboard inputs via Windows API postmessage/sendmessage to a guest OS.

What you could be doing if you don't want to change a lot of code is to copy your autoit script to the guest via vmrun and then run the script in the guest itself.

This is only possible if you know the username/password of the logged in user in the guest.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
griefman
Contributor
Contributor

Hey Wil,

I have the feeling that you didnt really read, what i was trying to explain, because there is simply no way that you could consider this a security risk. It is exactly the same risk as just staying there infront of the vm and clicking with the mouse on your own. If am however not seeing through something that you might know, like for example that there was a specific reason to do something specific in the new version wrt the keyboard and mouse input, i would like you to please share this knowledge. Otherwise i can't consider this in any way to be a security feature, because we are talking about something that is here since version 14, and since VMware workstation is not a product which limits you to do stuff, but rather is a tool, which enables you to do more, i would rather look at this as a bug, than considering it a feature, which has no on/off switch and no clear reason to be there, but is simply a limitation.

I really think that you did not get my point, why i would need this, because the suggestions, which you mentioned, are just not compatible, with what i want to do.

Here is an example:

The test which i have to do is to enter my credentials in a UEFI based login screen. The test persists of entering username, jumping to the password and then sending a key combination to login. It is that simple.

There is simply no way to automate this inside the VM. I personally think that if there was a way, this would be a huge security issue Smiley Happy. Nevertheless VIX and vmrun are of no help here, unless the can send key strokes in the vmv which as far as i know, they cant. This is why i would rather do it in a combination with image recognition and outside of the vm, on the host.

I hope you see my point now.

0 Kudos
wila
Immortal
Immortal

Hi,

An autoit script can be started by any windows executable and thus also by a virus.

With a bit of OCR and using the windows API you could control any guest OS via this way. So umm.. security issue?

re. control UEFI via vix/vmrun. No I don't think you can, it depends on vmware tools to be running.

What you can do OTOH is to enable the VNC interface on the VM and use that with your autoit script, see for example:

VMware Workstation Documentation Center

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
griefman
Contributor
Contributor

Hi,

well, yeah, sure, of course it is possible Smiley Happy Still, not really a concern in my opinion, don't forget that even Microsoft lets you disable UAC if you want to Smiley Happy so i still do think that this is a bug and not a feature Smiley Happy There are apparently plenty of input issues in version 14, if you go through the recent posts.

the VNC thing is a very nice workaround though and i think i will try it out. Thanks!

Best

0 Kudos
wila
Immortal
Immortal

Hi,

In regards to if it is bug or feature, you can always try to report it to VMware, the forums are not always the best place for reporting issues.

For the record I do not work for VMware, I'm a volunteer, aka a Workstation user that is just trying to help out other users.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
0 Kudos
griefman
Contributor
Contributor

Thanks a lot! I appreciate you trying to help!

0 Kudos
ramanujanSriniv
Contributor
Contributor

@griefman  brother I Need your help.

 

0 Kudos