在Windows Virtual XP模式下使用Powershell v2.0执行时,以下脚本无效:
# 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 = new-object -comobject "VirtualPC.Application"
在Windows Virtual XP Mode中不起作用
什么是需要在Windows Virtual XP模式下使用的comobject?
我已确定此说明 - > $vpc.USBDeviceCollection | select -ExpandProperty DeviceString
需要用此指令替换 - > $vpc.IVMDeviceCollection | select -ExpandProperty DeviceString
答案 0 :(得分:0)
您是否尝试在XP模式下查看注册表?只能在虚拟机的注册表中注册对象。