im tring to attach a usb device with an ID to my xp mode (virtual machine). Here is the code i found on the internet.
# Connect to Virtual PC
$vpc = new-object -comobject "VirtualPC.Application"
# Get VM name
$vmName = Read-host "Specify the name of the virtual machine that you want to use"
# List available USB devices
write-host "The following USB devices are available:"
$vpc.USBDeviceCollection | select -ExpandProperty DeviceString
# Get the USB device name
$usb = Read-host "Enter the name of the USB device that you want to connect to the virtual machine"
# Get the VM object
$vm = $vpc.findVirtualMachine($vmName)
# Get the USB object
$usbDevice = $vpc.USBDeviceCollection | ? {$_.DeviceString -eq $usb} | select -first 1
# Attach the device - this will fail if the VM is not running
$vm.AttachUSBDevice($usbDevice)
Now the following line gives the name of the device:
$vpc.USBDeviceCollection | select -ExpandProperty DeviceString
I want to see the ID of the Device. If you go to Device manager and select an "Unknown Device" -properties -details -Hardware IDs you'll see the id of that device and i want to get this id in Powershell so i can assagin it with the device id to my VM(xp mode)
I'm pretty new to powershell, mybe there is a way to see all the properties $vpc.USBDeviceCollection but i dont know how...
Can someone help me out? Thx!
VirtualPC.Application not have a DeviceID property.
Try read here for got it using wmi
http://blogs.msdn.com/b/powershell/archive/2007/02/24/displaying-usb-devices-using-wmi.aspx