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.

Share
Published by
Nirmal Sharma
Tags Powershell

Recent Posts

Losing your edge? 7 free tools to keep you focused at work

Staying focused at work in an always-connected world is hard! Here’s how to use tech — and some free tools…

14 hours ago

What’s next in the evolution of biometrics and facial recognition technology?

Facial recognition technology has matured to the point of being reliable — for better or for worse. What does the…

19 hours ago

Locking down your Exchange server with cipher suites

Cipher suites are a set of algorithms you need to secure your environment, either by using SSL and TLS. Here’s…

22 hours ago

AI cyber risks: What to look out for when deploying AI technology

Artificial intelligence has greatly improved modern life. But businesses must recognize that AI cyber risks exist and take appropriate measures.

2 days ago

Review: Office 365 synchronizing and administration tool CiraSync

CiraSync offers an enterprise solution for syncing global address list contacts and calendars to smartphones and other mobile devices. Here’s…

2 days ago

HIPAA IT compliance: Privacy and security rules you must know

HIPAA is the mandatory health regulation that must be followed strictly. But if you’re an IT pro in the health-care…

2 days ago