Disconnect USB devices programmatically at runtime from guest to host and vice versa in Workstation



I am using a VMWare Workstation VM using Vmware-kvm and I would like to programatically connect and disconnect USB devices connected to the host to my guest operating system, and vice versa. Basically the same way I would do it in the VMWare Workstation UI by selecting "Disconnect from Host", but I do not want to show the Workstation UI, but rather would like to hide it. Instead, I would like to run a program or script from inside the Guest VM (or from the host) that allows me to connect or disconnect any USB device connected to the host.


Is there any tool or API to achieve this? I know that I can edit the VMX file to influence the connection behaviour at startup, but I would like to perfrom this at runtime using a script, tool, program or whatever it takes to make this work.


Any suggestions are welcome, thank you!

0 Kudos
0 Replies