Share via


IVMVirtualMachine::AttachedDriveTypes property

The AttachedDriveTypes property contains an array indicating the type of drive attached to each location in the virtual machine.

This property is read-only.

Syntax

HRESULT get_AttachedDriveTypes(
  [out] VARIANT *driveTypes
);

VB
VMVirtualMachine.AttachedDriveTypes( _
  ByRef driveTypes _
)

Property value

Contains an array of Byte objects representing the VMDriveType of each device connected to every bus location. The array is ordered by [busType][busNumber][deviceID].

This property value is read-only.

Error codes

Name Meaning
S_OK
The operation was successful.
E_POINTER
The driveTypes parameter is NULL.
VM_E_VM_UNKNOWN
The configuration is unknown.
DISP_E_EXCEPTION
An unexpected error has occurred.

Examples

The following example displays the AttachedDriveTypes property value array of a VMVirtualMachine object.

Set objVS = CreateObject("VirtualServer.Application")
Set objVM = objVS.FindVirtualMachine("Windows Server 2003")

Wscript.Echo "VM Name: " & objVM.Name

Set colDrives = objVM.AttachedDriveTypes

WScript.Echo "Attached Drives: "
For Each objDrive in colDrives
  If objDrive = 2 Then
    Wscript.Echo "  DVD/CDROM disc drive attached"
  Elseif objDrive = 1 Then
    Wscript.Echo "  Hard disk drive attached"
  Else
    Wscript.Echo "  (no drive attachment)"
  End If
Next

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