top of page
No tags yet.




  • Facebook - Black Circle
  • Twitter - Black Circle
  • Instagram - Black Circle
  • LinkedIn - Black Circle

Powershell: Failover a SQL Service in a Failover Cluster

Is this where clusters go when they die?

A great way to test failover or to simply move disable a clustered SQL Service is to utilize powershell. You can create a script and hand it over to the server team or you can schedule it.

Most of the time certain cluster maintenance tasks take place after business hours. And if you've already worked a long day, it may free up a bit of your time and energy to use powershell.

Now, the failover cluster module is only available if Failover Clustering is installed locally. So it's not a module you can import on your workstation. The best way to do this is to use powershell remoting to remote into the cluster.

Read more about Enable-PSRemoting.

With that all squared away, I use this command to identify the cluster resources (so I can use the correct name when disabling a Cluster service).

You can use this to identify all the resources that you want to move. In one case, I had to failover sixteen SQL Server instances. I'm not going to do that one by one. I took the output of the above and put it into a text file.

Then I wrote a quick and dirty loop in powershell that utilized the Move-ClusterGroup. I read each of the resources in the text file and failed over to the desired node.

Much easier than doing it one by one.

bottom of page