How to delete a Windows Failover Cluster via Powershell

Table of Contents

Case #

You have a Windows Failover Cluster (WFC) comprising one or more nodes. The WFC cluster can be a physical cluster (for example a Hyper-V cluster) or a virtual (aka guest) cluster, for example a SQL Server virtual machine cluster. This article provides guidance on how to delete a Windows Failover Cluster via Powershell.

If you need to deploy a Hyper-V Windows Failover Cluster via Powershell, you should consult the following KB article:

For more details and design considerations about Windows Failover Clusters, you should review my book at

Solution #

Carry out the following steps to delete a Windows Failover Cluster via Powershell.

  • First off, review the current state of your WFC cluster by running the following cmdlets.
  • Ensure that the cluster nodes do not service any application workloads or end user traffic.
  • Gracefully stop all WFC roles, for example stop all SQL Server clustered instances running on a SQL Server guest cluster. Run the following cmdlets to accomplish this.
#Identify the resources or resource group which includes all resources related to the cluster roles you need to stop
Stop-ClusterGroup "Resource Name"

  • At this point, you must uninstall and cleanup any software installed on the WFC nodes which is related to the clustered roles, for example SQL Server cluster node or Hyper-V. Unless you perform this task, you may have issues with your cluster nodes being left in an inconsistent state (for example Active Directory stale objects) and you may receive unexpected errors. An example of graceful removal of a SQL Server guest cluster node is shown below.
  • After you have removed the underlying guest cluster services from each node, then run the Remove-ClusterNode cmdlet on that node: The Remove-ClusterNode cmdlet removes a node from a failover cluster. After the node is removed, the node no longer functions as part of the cluster unless the node is added back to the cluster. Removing a node is also called evicting a node from the cluster. Note: This cmdlet cannot be run remotely without Credential Security Service Provider (CredSSP) authentication on the server computer.
Remove-ClusterNode [Node name]
Clear-ClusterNode [Node name]
  • Repeat the above three (3) steps for all remaining WFC nodes, except for the last cluster node. If you try to remove the last cluster node you will receive the following error. At this point you are ready to run the Remove-Cluster cmdlet as described below.
Get-Cluster -Name [Cluster Name] | Remove-Cluster -CleanupAD

Finally validate there are no leftovers in file system, in registry and in cluster objects in the operating system of the cluster nodes. Double check the operating system event logs that there are no warnings or errors which may impact your server(s).

Powered by BetterDocs