Failover All Cluster Resources With Powershell

Here’s a simple example showing how to manage the failover process with Powershell, making sure all resources are running on one node. First, execute the below command to show which node owns the resources.

?View Code POWERSHELL
Get-ClusterGroup -Cluster ClusterName | Format-Table -AutoSize;
Name              OwnerNode     State
----              ---------     -----
SoStagSQL20Dtc    Node1 	Online
SQL Server        Node1 	Online
Cluster Group     Node1 	Online
Available Storage Node1 	Online

In this example all services are currently running on Node1. It’s a simple Powershell one-liner to failover everything to another node. The following example assumes a 2 node cluster and all services will be failed over to the other node;

?View Code POWERSHELL
Get-ClusterNode -Cluster ClusterName -Name Node1 | Get-ClusterGroup | Move-ClusterGroup | Format-Table -Autosize;

All services are now running on Node2

Name			OwnerNode	State
----			---------	-----
SoStagSQL20Dtc		Node2		Online
SQL Server		Node2		Online
Cluster Group		Node2		Online
Available Storage	Node2		Online

If you have more than 2 nodes in the cluster you can use the -Name parameter of the Move-ClusterGroup to specify a node to move resources to.

?View Code POWERSHELL
Get-ClusterNode -Cluster ClusterName -Name Node1 | Get-ClusterGroup | Move-ClusterGroup -Name Node2 | Format-Table -Autosize;

You may also like

Powershell for Failover Clustering
Unable to start Cluster Service on one Node
Cluster Network ‘SAN1’ is Partitioned


Leave a Reply