Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Initiate a cluster failover

234 views
Skip to first unread message

Mark Z.

unread,
Mar 5, 2008, 4:26:01 PM3/5/08
to
I'm trying to write a script to initiate a failure on a cluster group to
another node, I want the behavior to mimic the behavior when you right-click
a resource in cluster administrator, and select "initiate failure".

This snippet below is using the FailResource method, but doesn't seem to
initiate a failure for the cluster group, it seems to be just for testing, it
looks to just fail the individual resource for a moment and that's it.

Set colResourceList = objWMIService.ExecQuery _
("Select * from MSCluster_Resource WHERE Name = 'TestResource'")
For Each objResource in colResourceList
objResource.FailResource
Next

Any ideas to initiate a true failure like you can in the GUI of Cluster
Administrator?

I was able to use the MoveToNewNode method of the MSCluster_ResourceGroup
Class, but then if I code in the name of that node, and it's already on that
node, that doesn't meet the requirements.

Dominic Johnson

unread,
Mar 6, 2008, 3:43:55 AM3/6/08
to
Mark,

you should be able to use the association classes to get your cluster
node names and then to identify which node holds the resource group
you want to failover.

In this way you should be able to provide the MoveToNewNode method
with the correct name of the node that is your failover target.

Dominic

Mark Z.

unread,
Mar 6, 2008, 11:52:04 AM3/6/08
to
I did get MoveToNewNode method to work, but I can't seem to find out the node
that holds the cluster group... that continues to elude me.

Dominic Johnson

unread,
Mar 7, 2008, 8:23:09 AM3/7/08
to
On 6 Mar, 16:52, Mark Z. <Ma...@discussions.microsoft.com> wrote:
> I did get MoveToNewNode method to work, but I can't seem to find out the node
> that holds the cluster group... that continues to elude me.


I don't have access to a cluster to test this and it's some time since
I last worked on it but this may give you a starting point...


strClusterName = "CLUS01"

Set objWMIService = GetObject("winmgmts:\\" & strClusterName & "\root
\MSCluster")

Set colItems = objWMIService.ExecQuery("Associators of
{MSCluster_Cluster.Name='" & strClustername & "'} WHERE AssocClass =
MSCluster_ClusterToNode")

For each objitem in colItems

wscript.echo objItem.Name

Set colAGItems = objWMIService.ExecQuery("Associators of
{MSCluster_Node.Name='" & objitem.Name & "'} WHERE AssocClass =
MSCluster_NodeToActiveResource")

For each objAGItem in colAGItems

wscript.echo vbtab & objAGItem.Name

Next

Next

This should write out the cluster node name and the active resources
associated with it. Watch out for line wrap.

Dominic

Mark Z.

unread,
Mar 10, 2008, 12:37:04 PM3/10/08
to
The proper calling of association classes is what I needed help was the
trick! This should get me what I need.

Thank you very much!

0 new messages