Script recipe: How to enumerate dependencies for all resources in a cluster
A few days ago I wanted to gather more data from a cluster on a customer site. I hoped that the uber-management tool for MSCS called CLUSTER.EXE can be used to enumerate the dependencies for all resources in the system, since it can enumerate the dependencies for a certain resource, for example, and can enumerate all the resources in the system. However, I could not find any option to do that...
What was my next option then? Well, starting with Windows 2000, there is a new set of COM objects for cluster management. These objects ar automation-compatible and offer an extremely simple way to manage a cluster. So I wrote a small VBS script that does the task above. As you can see, it is something extremely simple:
Set objCluster = CreateObject("MSCluster.Cluster")
objCluster.Open ""Dim resource
for each resource in objCluster.Resources
wscript.echo "Resource: " & resource.Name
dim res2
for each res2 in resource.Dependencies
wscript.echo "- dependency: " & res2.Name
next
wscript.echo "--------"
next
Done!
P.S. Did you know that in earlier versions of windows, there was a easter egg in the CLUSTER.EXE tool. If you typed "cluster rocks" you will get some interesting messages :-) AFAIK, this easter egg is now gone in Windows 2000 and later.