IVMVirtualMachine::AttachUSBDevice method

[Windows Virtual PC is no longer available for use as of Windows 8. Instead, use the Hyper-V WMI provider (V2).]

Attaches a USB device to a virtual machine (VM).

Syntax

HRESULT AttachUSBDevice(
  [in] IVMUSBDevice *inUSBDevice
);

Parameters

inUSBDevice [in]

A IVMUSBDevice pointer that represents the USB device connected to the host.

Return value

This method can return one of these values.

Return code/value Description
S_OK
0
The operation was successful.
E_POINTER
0x80004003
The parameter is NULL.
VM_E_VM_NOT_RUNNING
0xA0040206
The VM is not running.
VM_E_VM_UNKNOWN
0xA0040207
The configuration is unknown.
VM_E_ADDITIONS_NOT_AVAIL
0xA0040504
Integration Components are not available in the guest operating system.
VM_E_ADDITIONS_FEATURE_NOT_AVAIL
0xA0040505
The USB feature is not available.
VM_E_USB_CONNECTOR_DRIVER_ERROR
0xA00400925
There was a USB Connector driver error.
VM_E_USB_ATTACH_FAILED_MORE_DEVICES
0xA00400931
Cannot attach more devices to the VM.
VM_E_USB_ATTACH_FAILED_GP_ERROR
0xA00400932
A group policy setting is preventing the USB redirection.
VM_E_USB_ATTACH_FAILED_ALREADY_ASSIGNED
0xA00400933
A USB device has already been attached by some other client.
VM_E_USB_ATTACH_FAILED
0xA00400926
The attach operation failed.
DISP_E_EXCEPTION
0x80020009
An unexpected error has occurred.

Requirements

Minimum supported client
Windows 7 [desktop apps only]
Minimum supported server
None supported
End of client support
Windows 7
Product
Windows Virtual PC
Header
VPCCOMInterfaces.h
IID
IID_IVMVirtualMachine is defined as f7092aa1-33ed-4f78-a59f-c00adfc2edd7

See also

IVMVirtualMachine