Scripting Microsoft Clusters
Saturday, March 13, 2010 at 10:22PM - Safely reboot servers in a Microsoft cluster
- Determine which node is active and gracefully moves resources before reboot
We have a number of processes at the grind on Microsoft Windows servers that require 24/7 availability. However we also have compliance obligations that require us to patch our servers within a certain time of a critical patch coming out.
Enter MSCS, Microsoft Clustering Services!
We've got a simple active/passive cluster made up of just two servers, so I wrote a script that I configured each node to run before shutting down. The script checks to see if the node is the active and, if it is, to gracefully transfer all the other resources to the active node before shutting down.
The script takes only the argument of the machine you're wanting to reboot. Since I've got it configured via GPO and VMware Tools I specify the %COMPUTERNAME% variable as an argument to the script, failover.bat %COMPUTERNAME%.
In a nutshell we're checking for the existence of the quorum drive (Q:\) to determine active/passive status then using the built-in cluster.exe to gracefully transfer any resources running on the node.
Looks a bit like this:

Reader Comments