Solved

Retrieving Cluster info from "MSCluster.Cluster"

Posted on 2012-04-11
4
1,570 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

How does your email signature look on mobiles?

Do your employees use mobile devices to reply to emails? With mobile becoming increasingly important to the business world, it is in your best interest to make sure that your email signature looks great across all types of devices.

Join & Write a Comment

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

9 Experts available now in Live!

Get 1:1 Help Now