共用方式為


IVMVirtualServer::VirtualMachines property

The VirtualMachines property contains a collection of IVMVirtualMachine objects.

This property is read-only.

Syntax

HRESULT get_VirtualMachines(
  [out] IVMVirtualMachineCollection **virtualMachineCollection
);

VB
VMVirtualServer.VirtualMachines( _
  ByRef virtualMachineCollection _
)

Property value

The IVMVirtualMachineCollection object associated with Virtual Server.

This property value is read-only.

Error codes

Name Meaning
S_OK
The operation was successful.
E_POINTER
virtualMachineCollection is NULL.
DISP_E_EXCEPTION
An unexpected error occurred.

Examples

The following example displays properties of the VirtualMachines object associated with the VMVirtualServer object.

Set objVS = CreateObject("VirtualServer.Application")
Wscript.Echo "Name: " & objVS.Name

Set objVMColl = objVS.VirtualMachines
If objVMColl.Count = 0 Then
  Wscript.Echo "    Virtual machines: [none]"
Else
  Wscript.Echo "Virtual machines: " & objVMColl.Count
  For Each objVM in objVMColl
    Wscript.Echo "    Name: " & objVM.Name
  Next
End If

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

IVMVirtualServer