Getting a List of All Servers in a Cluster
Getting a List of All Servers in a Cluster
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 following example returns a list of all of the servers in the cluster. This example uses a function for Getting the Property Value of a Cluster Resource.
Visual Basic
'////////////////////////////////////////////////////////////////////// ' Function: getClusterServerList() ' Purpose: Returns a list of all of the servers in the cluster. ' ' Input: szServerName: Name of cluster server to query ' ' Output: getClusterServerList: Contains Error code (if any) ' szServerList: List of servers ' ' Note: In order for this example to function correctly, it may be necessary to include ' references to the following libraries: Active DS Type Library, Microsoft CDO for ' Exchange Management Library, Microsoft Cluster Service Automation Classes, ' Microsoft CDO for Windows 2000 Library. '////////////////////////////////////////////////////////////////////// Public Function getClusterServerList(ByVal szServerName As String, _ ByRef szServerList As String) As Integer Dim oCluster As New msclusterlib.Cluster Dim oGroups As msclusterlib.ClusResGroups Dim iGroupCount As Integer Dim szClusterServerName As String On Error GoTo errhandler oCluster.Open szServerName Set oGroups = oCluster.ResourceGroups szServerList = "" For iGroupCount = 1 To oGroups.Count getPropertyValue oGroups(iGroupCount), "Network Name", "Name", szClusterServerName If szServerList = "" Then szServerList = szClusterServerName Else szServerList = szServerList + ";" + szClusterServerName End If Next getClusterServerList = 0 ' Clean up. Set oCluster = Nothing Set oGroups = Nothing Exit Function ' Error handling. errhandler: ' Implement error logging here. Set oCluster = Nothing Set oGroups = Nothing getClusterServerList = 1 End Function
Send us your feedback about the Microsoft Exchange Server 2003 SDK.
Build: June 2007 (2007.618.1)
© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.