Solved

Retrieving Cluster info from "MSCluster.Cluster"

Posted on 2012-04-11
4
1,588 Views
Last Modified: 2012-06-27
I can retrieve all the info about the Nodes from "MSCluster.Cluster", but I can't seem to be able to get the info about the Virtual IP address or any other properties ?

Wscript.Echo objCluster.Resources.Item(1).Name     'Works

But how do I get the virtual address and stats ?
0
Comment
Question by:sidwelle
  • 3
4 Comments
 
LVL 22

Assisted Solution

by:65td
65td earned 500 total points
ID: 37835148
0
 

Author Comment

by:sidwelle
ID: 37835259
Nice snip,  but the "PowerON Hours" did not populate ?

and There is no info about the virtual address ?
0
 

Accepted Solution

by:
sidwelle earned 0 total points
ID: 37839442
Here is what I came up with. Can someone please run this on there cluster to see if it works and how portable it is ?

I am interested to see what the "getGroupName" function returns.

Thanks

Option Explicit

Dim msg
Dim objArgs, objCluster
Set objArgs = WScript.Arguments
Set objCluster = CreateObject("MSCluster.Cluster")
If objArgs.Count > 0 Then
    objCluster.Open(objArgs(0))
Else
    objCluster.Open("")	'Local Cluster ...
End If

'WScript.Echo "Successfully opened " & objCluster.Name

Dim ver 
ver = objCluster.Version.MajorVersion & "." & _
	objCluster.Version.MinorVersion 

msg = msg & "Cluster Name: " & objCluster.Name & "" & vbCr
msg = msg & "Group Name: " & getGroupName(objCluster) & vbCr
msg = msg & "Cluster Address: " & getClusterAddress(objCluster) & vbCr
msg = msg & "Node Count: " & objCluster.Nodes.Count & vbCr
msg = msg & "Version: " & ver & vbCr

Dim owner
owner = objCluster.ResourceGroups.Item("Cluster Group").OwnerNode.Name
msg = msg & "Owner Node: " & owner & vbCr
msg = msg & "=================================" & vbCr

WScript.Echo msg

Set objCluster = Nothing
Set objArgs = Nothing

Function getClusterAddress(objCluster)
	Dim Msg3  , Pname, ClusterAddress, x, i,j, name
	
	'WScript.Echo objCluster.Resources.Count
	X = objCluster.Resources.Count
	For I = 1 To X
		name = objCluster.Resources.Item(i).Name
		'WScript.Echo "Rescurces (" & I & ") " &  name
		
		If name = "Cluster IP Address" Then		'we found the resource ...
			For J = 1 To objCluster.Resources.Item(I).PrivateProperties.Count
				Pname = objCluster.Resources.Item(I).PrivateProperties(J).Name
				'WScript.Echo Pname
				
				If Pname = "Address" Then
					'WScript.Echo "Address: " & objCluster.Resources.Item(I).PrivateProperties(J).Value
					
					getClusterAddress = objCluster.Resources.Item(I).PrivateProperties(J).Value
				End If
				
			Next
		End If
	Next

End Function

Function getGroupName(objCluster)
	Dim X, I, J, Y
	
	X = objCluster.ResourceGroups.Count
'	For I = 1 To X
		'rtype = objCluster.ResourceGroups.Item(I).
		''WScript.Echo "(" & I & ") " & objCluster.ResourceGroups.Item(I).Name '& ", Type: " '& rtype
		'WScript.Echo objCluster.ResourceGroups.Item(I).Resources.
		
		'Y = objCluster.ResourceGroups.Item(I).PrivateProperties.Count
		'	Y = objCluster.ResourceGroups.Item(I).Cluster.ResourceTypes.Count
		'	WScript.Echo ".Cluster.ResourceGroups.Count: " & Y
		'	For J = 1 To Y
		'	 	WScript.Echo "(" & J & ") " & objCluster.ResourceGroups.Item(I).Cluster.ResourceTypes.Item(J).Name
		'Next
'	Next

	getGroupName = objCluster.ResourceGroups.Item(x).Name

End Function

Open in new window

0
 

Author Closing Comment

by:sidwelle
ID: 37932271
thanks for replying.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now