我想将带有 ID 的 USB 设备连接到我的 xp 模式(虚拟机)。这是我在互联网上找到的代码。
# 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)
现在下面一行给出了设备的名称:
$vpc.USBDeviceCollection | select -ExpandProperty DeviceString
我想查看设备的 ID。如果您转到设备管理器并选择“未知设备”-properties -details -Hardware IDs,您将看到该设备的 ID,我想在 Powershell 中获取此 ID,以便我可以将其与设备 ID 一起添加到我的 VM (XP模式)
我对powershell很陌生,我有一种方法可以查看所有属性 $vpc.USBDeviceCollection 但我不知道如何...
有人可以帮我吗?谢谢!