Hi guys,
I want to get a list of the available USB devices from vSphere PowerCLI. The devices are connected to my ESXi 6.0 server.
I am able to get the list of devices with 'lsusb' from ESXi Shell.
Also, can I use VendorId or ProductId to connect the USB device to a VM again form PowerCLI.
And what if you run ESXi shell commands through SSH connection from Jenkins? This way you could bypass PowerCLI and still run these tests.
Have you seen this doc? Get-UsbDevice
Yes, that gives you the devices that have been connected to a specific virtual machine. What I need is the list of devices that are available to connect to.
I don't think what you're trying to accomplish is possible from vSphere level. Have you tried running
tail -f /var/log/vmkernel.log | grep -i USB
from ESXi shell?
If you can get a list of devices using lsusb, why would you insist on using PowerCLI?
I would like to Revert/Start/Stop/Delete VM as well as connect USB devices to them using the PowerCLI, so that I can run these commands from Jenkins. The purpose of all of this is to to run automated tests on these VMs.
Ideally, I want the connection to the USB devices to be foolproof in order to avoid any failure.
I'm considering to make an usb.autoConnect.device in .vmx file of the VM, but I'm afraid this would give errors if another machine is trying to use the same device. The best way is to get the list of available devices in order to know what is available for use.
And what if you run ESXi shell commands through SSH connection from Jenkins? This way you could bypass PowerCLI and still run these tests.
That's an option I considered, but will I be able to start/stop/revert/delete VM from the ESXi Shell?
ESXi shell:
power on: vim-cmd vmsvc/power.on <vmid>
power off: vim-cmd vmsvc/power.off <vmid>
delete: vim-cmd vmsvc/destroy <vmid>
Here is a list of most common VM-oriented commands in PowerCLI/vMA/ESXi cli VMware Knowledge Base
Thank you very much!
You are very welcome my Linux friend
Please let me know if you'd any further assistance
And do you know where I can find the commands for connecting disconnecting a USB device using ESXi shell
I suggest reading through this doc to better understand vim-cmd commands. Most operations can be "figured out" after reading this https://communities.vmware.com/servlet/JiveServlet/downloadBody/31025-102-1-44609/Quick%20Tutorial%2...