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.

Re: Initiate a cluster failover by Dominic

Dominic
Thu Mar 06 02:43:55 CST 2008

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


Re: Initiate a cluster failover by MarkZ

MarkZ
Thu Mar 06 10:52:04 CST 2008

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" wrote:

> 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
>
>

Re: Initiate a cluster failover by Dominic

Dominic
Fri Mar 07 07:23:09 CST 2008

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

Re: Initiate a cluster failover by MarkZ

MarkZ
Mon Mar 10 11:37:04 CDT 2008

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!



"Dominic Johnson" wrote:

> 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
>