The following script does not work when executed using Powershell v2.0 in Windows Virtual XP Mode:
# 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)
This instruction --> $vpc = new-object -comobject "Vir开发者_如何转开发tualPC.Application"
does not work in Windows Virtual XP Mode
What is the comobject that needs to be used in Windows Virtual XP Mode?
I have determined that this instruction --> $vpc.USBDeviceCollection | select -ExpandProperty DeviceString
needs to be replaced with this instruction --> $vpc.IVMDeviceCollection | select -ExpandProperty DeviceString
Did you try looking in the registry in XP Mode? Only objects registered in the registry in the virtual machine can be created.
精彩评论