Solved

Retrieving Cluster info from "MSCluster.Cluster"

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Any tool or Script which can shows duplicated file based on its size in File server ? 6 72
Compile Error 7 53
AD backup 6 59
Excel 2016 loop through 6 36
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Issue: One Windows 2008 R2 64bit server on the network unable to connect to a buffalo Device (Linkstation) with firmware version 1.56. There are a total of four servers on the network this being one of them. Troubleshooting Steps: Connect via h…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

832 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