The complete operation of Windows failover clusters can be managed using PowerShell. PowerShell not only reduces the time it takes to perform tasks using the GUI, but also enables automation. For example, in case you need to perform a failover cluster operation task every day, you can find a failover PowerShell cmdlet that can help you perform the required tasks automatically using a scheduled task. This article explains how to import Windows failover cluster PowerShell modules and how to use the available PowerShell cmdlets to manage Windows failover clusters.

Importing Windows failover cluster PowerShell cmdlets

Windows Server implements the “FailoverClusters” Windows PowerShell module library, which provides PowerShell cmdlets to work with Windows failover clusters. When you enable the failover cluster role on a Windows Server, the installation process installs the required Windows failover cluster PowerShell modules. Before you can execute any of the Windows failover PowerShell cmdlets, you will be required to import the modules in a PowerShell session by executing the “Import-Module” command as shown in the command below:

  1. Launch Windows PowerShell with administrator privileges from the Start Menu.
  2. To import the Windows failover cluster module, type the following cmdlet:

Import-Module failoverclusters
Tip: In case you would like PowerShell to import the failover cluster module every time you run PowerShell, you can do so by modifying the Windows PowerShell profile.

Listing Windows failover cluster PowerShell cmdlets

There are PowerShell cmdlets available to work with different aspects of a Windows failover cluster. For example, you can use Add-ClusterDisk PowerShell cmdlet to add a cluster disk in a failover cluster. Similarly, the Add-ClusterSharedVolume PowerShell cmdlet can be used to add a CSV volume to the failover cluster. To get a list of failover cluster PowerShell cmdlets, use this command:

Get-Command –Module FailoverClusters

The above command will list all the PowerShell cmdlets that are available in the FailoverClusters module. There are PowerShell cmdlets that help you collect information from a Windows failover cluster. There are a few PowerShell cmdlets that you can use to process modifications in a Windows failover cluster and there are PowerShell cmdlets available that can be used to perform deletion operations in the failover clusters.

Testing a failover cluster using PowerShell

You may find it necessary to run validation tests against a Windows failover cluster every week or so to ensure the failover cluster is operating normally. You can use Windows Failover Cluster Manager to run the validation tests and provide you with a detailed report, but rather than using the Cluster Manager GUI you can use Test-Cluster PowerShell cmdlet. The tests will be captured in a file that you will specify when you run the Test-Cluster PowerShell command. The Test-Cluster cmdlet supports multiple types of tests such as cluster test, inventory, network, storage, and a few system tests.

Testing system and cluster drivers

In case you need to verify that ensure system and cluster drivers are using the correct version, just execute this PowerShell command:

Test-Cluster –Include “List System Drivers”, “List Unsigned Drivers”

Clearing cluster configuration of an evicted node

You may find the Clear-ClusterNode PowerShell cmdlet useful if you need to remove the complete configuration of a node that was evicted from the cluster. Sometimes it is necessary to ensure that all the configuration information for the evited node has been removed from the cluster. Execute this command with “-Force” switch:

Clear-ClusterNode PRDNode1 –Force

The “-Force” parameter in this command ensures that the information pertaining to PRDNode1 is removed from the cluster.

The most common PowerShell cmdlets that you would want to use are Test-Cluster to validate a cluster as explained in above in this article, Update-ClusterVirtualMachineConfiguration to update virtual machine configuration that are operating in a cluster, Set-ClusterLog to set the cluster log levels, Get-ClusterQuorum to get cluster quorum configuration information, and Get-ClusterLog for troubleshooting cluster-related issues.

Starting with Windows Server 2012 R2, the complete operation of the cluster can be managed using the failover PowerShell cmdlets.

Nirmal Sharma

Nirmal Sharma is a MCSEx3, MCITP and was awarded the Microsoft MVP award in Directory Services and Windows Networking. He specializes in Microsoft Azure, Office 365, Directory Services, Failover Clusters, Hyper-V, PowerShell Scripting and System Center products. Nirmal has been involved with Microsoft Technologies since 1994. In his spare time, he likes to help others and share some of his knowledge by writing tips and articles on various sites.

Published by
Nirmal Sharma
Tags Powershell

Recent Posts

Intel and MediaTek announce 5G modem solutions partnership

A new partnership between Intel and MediaTek to develop 5G modem solutions wants to be in the fast lane when…

4 hours ago

Azure Quick Tip: Troubleshooting your code with test pane

Sometimes, it’s the simple things that can save you a lot of headaches. As this Quick Tip shows, always make…

6 hours ago

Creating bootable ISO files for Windows 10 the easy way

Microsoft has simplified the process of creating bootable ISO files, and we show you the easiest ways to create them…

8 hours ago

Review: Office 365 management solutions CoreLearning and CoreAdoption

CoreLearning and CoreAdoption are powerful solutions to drive end-user adoption of Office 365 applications, services, and features. Here’s our review.

11 hours ago

Windows 7, TrueCrypt and KB4530734 - Configuring Windows Boot Loop

In case you are using Windows 7 with System Disk encrypted by TrueCrypt(Possibly VeraCrypt is affected as well) and boot…

19 hours ago

Moving Azure resources: Pay attention to the details!

Here’s a simple but efficient way to move your Azure resources. This quick tutorial will show you how to do…

1 day ago