Get started with the Failover Clustering PowerShell-module

In Windows Server 2008 R2 the Failover Clustering feature contains a Windows PowerShell-module for administering Failover Clusters. This module replaces the old cluster.exe tool which existed in previous versions of Windows Server.

The cmdlets in the Failover Clustering module for PowerShell are well documented on Microsoft TechNet: “Using Windows PowerShell Cmdlets on Failover Clusters in Windows Server 2008 R2”.

There is also a guide on “Mapping Cluster.exe Commands to Windows PowerShell Cmdlets for Failover Clusters”, which a member of the File Server team at Microsoft, Jose Barreto, has posted additional details on in a blog-post.

I recently created two new Failover Cluster for Hyper-V, and leveraged the Failover Clustering PowerShell module. Here is a sample on how easy it is to accomplish this:

   1: #Import Server Manager module
   2: Import-Module ServerManager
   4: # Add Failover Cluster and Hyper-V (requires a reboot)
   5: Add-WindowsFeature "Failover-Clustering","Hyper-V"
   7: #Configure networks in Hyper-V before moving on
   9: #Import Failover Clustering module
  10: Import-Module FailoverClusters
  12: #Create cluster validation report
  13: Test-Cluster -Node Node01,Node02
  15: #Inspect cluster validation report before moving on
  17: #Create a new failover cluster
  18: New-Cluster -Name Cluster01 -Node Node01,Node02 -StaticAddress
  20: #Inspect available cluster disks
  21: Get-ClusterAvailableDisk -Cluster Cluster01
  23: #Add all available cluster disks
  24: Get-ClusterAvailableDisk -Cluster Cluster01 | Add-ClusterDisk
  26: #Configure cluster quorom
  27: Set-ClusterQuorum -Cluster Cluster01 -NodeAndDiskMajority "Cluster Disk 01"
  29: #Enable Cluster Shared Volumes
  30: (Get-Cluster -Name Cluster01).EnableSharedVolumes="Enable/NoticeRead"
  32: #Add Cluster Shared Volume
  33: Add-ClusterSharedVolume -Cluster Cluster01 -Name "Cluster Disk 02"
  35: #Make VM 01 Highly Available
  36: Add-ClusterVirtualMachineRole  -Cluster Cluster01 -VirtualMachine "VM 01" -Name "VM 01"
  38: #Test cluster failover on VM 01
  39: Move-ClusterVirtualMachineRole -Cluster Cluster01 "VM 01" -Node Node02

Before running the commands in the example above, you must install the operating system and configure disks and networking for Failover Clusters according to the product documentation on Microsoft TechNet. If you are using a Windows Server 2008 R2 Core edition, the Core Configurator 2.0 might be handy if you`re not comfortable configuring IP-addresses and so on from the command line.


Additional resources

Failover Clustering and Network Load Balancing Team Blog

Cluster Related Sessions at TechEd Berlin 2010

Joachim Nässlander (Cluster MVP)

John Toner (Cluster MVP)


No Comments