The command “get-usbdevice”(also “Remove-UsbDevice”) should retrieve the USB devices that could be located on a VM. The problem is that cmdlt only will display those USB devices, if a USB device is currently connected. It will not report anything if the VM has added USB hardware but it currently isn’t connected to anything (ie Just a USB controller).
Now there are other ways that I can go about finding if the VM has that unwanted hardware:
$unwantedhw = “floppy|serial|usb” (Get-VM $VMname | Get-View).Config.Hardware.Device | Select -Expand DeviceInfo | Select Label, Summary | where {$_.Label –match $unwantedhw}
I just would of thought that instead of having to go back to some get-view shenanigans, I could do it directly with 1 command like the command “Get-UsbDevice” should do in my opinion. I could to try to write my own function (ie Get-USBController) for this and store it in my profile, but I dont have the time on hand atm.
Has anyone else created this function or know of any updates to the PowerCLI to include this in a later feature release??
Versions of PowerCLI:
VMware vSphere PowerCLI 5.0.1 build 581491
VMware AutoDeploy PowerCLI Component 5.0 build 544967
VMware ImageBuilder PowerCLI Component 5.0 build 544967
VMware vCloud Director PowerCLI Component 1.5 build 581492
VMware License PowerCLI Component 5.0 build 544881
VMware vSphere PowerCLI Component 5.0 build 581435
VMware vSphere Update Manager PowerCLI 5.0 build 432001