Link to home
Create AccountLog in
Avatar of TWCMIL
TWCMIL

asked on

VBScript to determine active node holding the cluster group

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.

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... I must do one of the following:

A. Initiate a true failure like you can in the GUI of Cluster
Administrator

or

B. Determine the node holding the cluster group, so I can use the MoveToNewNode Method to move the group to another node.

As a bonus, is there a way to determine when the cluster failed over?
Set colResourceList = objWMIService.ExecQuery _
("Select * from MSCluster_Resource WHERE Name = 'TestResource'")
For Each objResource in colResourceList
objResource.FailResource
Next

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of TWCMIL
TWCMIL

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account