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.
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
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
Thank you very much!