Hi Guys,
I have installed the vSphere PowerCLI on my machine. Is it possible to map a USB device connected to my machine to a vSphere VM through command line? I am able to do this currently using the vSphere client UI.
When i went though the PowerCLI documentation I could find only "Get-UsbDevice" and "Remove-UsbDevice". I need something to Add-Usbdevice and list USB devices. Please let me know if there is any way to achieve it from command line. Greatly appreciate you help in this matter.
Thanks,
-Ajith
Finally figured out a way to do that. It is possible using VMRC SDK. I am able to connect devices from my web page. Feel free to mail me if anyone needs any help in achieving this.
Afaik, connecting a VM to local USB devices, which can be done through the GUI, is done through private API.
So Im afraid there are no command line alternatives.
Btw the 2 USB related cmdlets you mention are for USB devices that are connected to the host, not the client.
There was a recent thread on this. See Discover USB Devices available for passthru
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD for the quick response. Is there any way to automatically connect USB devices to the VM from the client machine?
Not that I know of.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I came across the vSphere web client SDK today. I am wondering if its possible to build a plugin using the SDK to connect client USB devices?
If the answer is "yes" then i will go ahead and try to implement it.
With the ReconfigVM_Task method you can do some actions of host (ESXi) connected USB devices.
But local USB devices use private API afaik.
So no, there will not be a method in the SDK I'm afraid
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
that's bad news for me . I was building an app that needed to automatically map some phones to specific VM's. Looks like the user has to do it manually now. Thanks for saving my time LucD, otherwise i would have spent hours trying to figure it. Please let me know if VMware opens up the API in future or if you have any other idea's on how to solve this problem.
Can we have an API in CLI for connecting through the command line interface? At least is that there in any paid version?
I'm not sure what you mean with "paid" version in this context.
Afaik, the feature to attach local USB devices is only there in the vSphere client.
And that is based on a private API, similar to for example attaching a local ISO file.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Finally figured out a way to do that. It is possible using VMRC SDK. I am able to connect devices from my web page. Feel free to mail me if anyone needs any help in achieving this.
Great, would be nice if you could share the method you used.
If you use the VMRC SDK, isn't the solution limited to web applications only ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes this solution is limited to web applications because it connects to the browser client via java-script.
The SDK has a very nice example html page (vmrc-embed-example.html). The steps involved are
1) Create the browser plugin object
2) Start the plugin with an appropriate mode using vmrc.startup()
3) vmrc.getPhysicalClientDevices() will return an array of devices
4) vmrc.getPhysicalClientDeviceDetails() will return individual device details
5) vmrc.connect() will connect to a VM
6) vmrc.connectDevice() will connect it to the VM
Thanks ajdovahkin!
Thanks for sharing that
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'm interrested in this solution. Could you give us a sample ?