共用方式為


IVMVirtualMachine::NetworkAdapters property

The NetworkAdapters property contains an enumerable collection of NICs attached to the virtual machine.

This property is read-only.

Syntax

HRESULT get_NetworkAdapters(
  [out] IVMNetworkAdapterCollection **networkInterfaceCollection
);

VB
VMVirtualMachine.NetworkAdapters( _
  ByRef networkInterfaceCollection _
)

Property value

The IVMNetworkAdapterCollection object associated with this virtual machine.

This property value is read-only.

Error codes

Name Meaning
S_OK
The operation was successful.
E_POINTER
The networkInterfaceCollection 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 number of network adapters attached to a VMVirtualMachine object.

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

Wscript.Echo "VM Name: " & objVM.Name
WScript.Echo "Network adapters: " & colNICs.Count

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