This documentation is archived and is not being maintained.

VirtualMachine Property

Exchange Server 2003

VirtualMachine Property

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

The VirtualMachine property returns the name of the virtual machine that owns this resource. The VirtualMachine property is read-only, and is a key property of this class.

Applies To

The VirtualMachine property is a member of the ExchangeClusterResource Class.

Instance Path

The VirtualMachine property appears on instances of the \\COMPUTERNAME\ROOT\cimv2\applications\exchange:ExchangeClusterResource class.

MOF Syntax

[key] string VirtualMachine;

Qualifiers

key

Remarks

For more information about Microsoft Windows Clustering technologies, see the MSDN Web site Online link.

VBScript Example

The following example shows how to retrieve a list of ExchangeClusterResource instances on the specified Exchange server, and how to retrieve the VirtualMachine property on each ExchangeClusterResource instance.

'===============================================================
' Name:      ShowClusterResource_VirtualMachine
' Purpose:   Display each Cluster member found for Exchange server,
'            and show the VirtualMachine property on the
'            ExchangeClusterResource objects
' Input:     strComputerName [string] the computer to access
' Output:    Displays the name of each Connector and the
'            VirtualMachine property
'===============================================================
Public Sub ShowClusterResource_VirtualMachine ( strComputerName )

Const cWMINameSpace = "root/cimv2/applications/exchange"
Const cWMIInstance = "ExchangeClusterResource"

Dim strWinMgmts              ' Connection string for WMI
Dim objWMIExchange           ' Exchange Namespace WMI object
Dim listClusterResources     ' ExchangeClusterResource collection
Dim objExchangeConnector     ' A single ExchangeClusterResource WMI object

' Create the object string, indicating WMI (winmgmts), using the
' current user credentials (impersonationLevel=impersonate),
' on the computer passed to the function in strComputerName, and
' using the CIM namespace for the Exchange provider.
strWinMgmts = "winmgmts:{impersonationLevel=impersonate}!//" & _
   strComputerName & "/" & cWMINameSpace
'
' Get an object using the string you just created.
Set objWMIExchange =  GetObject(strWinMgmts)
'
' The Resources that currently exist appear as a list of
' ExchangeClusterResource instances in the Exchange namespace.
Set listClusterResources = objWMIExchange.InstancesOf(cWMIInstance)
'
' Were any ExchangeClusterResource Instances returned?
if (listClusterResources.count > 0) then
  ' If yes, do the following:
  ' Iterate through the list of ExchangeClusterResource objects.
  For each objExchangeConnector in listClusterResources
     '
     ' Display the value of the Name property.
     WScript.echo "Name = " & _
      "[" & TypeName(objExchangeConnector.Name) & "] " & _
       objExchangeConnector.Name
     '
     ' Display the value of the VirtualMachine property.
     WScript.echo "    VirtualMachine = [" & _
       TypeName(objExchangeConnector.VirtualMachine) & "] " & _
      objExchangeConnector.VirtualMachine
     '
     ' Move to the next ExchangeClusterResource.
  Next
else
  ' If no ExchangeClusterResource instances were returned,
  ' display that.
  WScript.Echo "No ExchangeClusterResource instances were returned."
end if
end Sub

Show: