Compartir a través de


IVMVirtualMachine::AddDVDROMDrive method

The AddDVDROMDrive method adds a new CD or DVD drive to the virtual machine.

Syntax

HRESULT AddDVDROMDrive(
  [in]  VMDriveBusType busType,
  [in]  long           busNumber,
  [in]  long           deviceNumber,
  [out] IVMDVDDrive    **dvdDrive
);

Parameters

busType [in]

Bus to attach the CD or DVD drive to.

busNumber [in]

Bus number to attach the CD or DVD drive to. For IDE, this number can be 0-1. DVDROM drives cannot be attached to the SCSI bus.

deviceNumber [in]

Device number to attach the CD or DVD drive to. For IDE, this number can be 0-1. DVDROM drives cannot be attached to the SCSI bus.

dvdDrive [out]

A new IVMDVDDrive object.

Return value

This method can return one of these values.

Return code Description
S_OK
The operation was successful.
E_POINTER
dvdDrive is NULL.
E_INVALIDARG
busType, busNumber, or deviceNumber is invalid.
VM_E_VM_UNKNOWN
The configuration is unknown.
VM_E_VM_RUNNING
Virtual machine is running or saved.
VM_E_DRIVE_BUS_LOC_IN_USE
The specified bus location is in use.
VM_E_DRIVE_INVALID
Invalid drive specified.
DISP_E_EXCEPTION
An unexpected error has occurred.

Remarks

You can only add a new CD or DVD drive to a stopped virtual machine.

Examples

The following example adds a DVD drive to the secondary IDE controller as the primary device.

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows Server 2003")
Set objDVD = objVM.AddDVDROMDrive(0,1,0)

Requirements

Product
Microsoft Virtual Server 2005 onWindows Server 2003
Download
Microsoft Virtual Server 2005 R2 SP1 Update onWindows Server 2008orWindows Server 2003
Header
VsComInterfaces.h

See also

IVMVirtualMachine

VMDriveBusType