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.
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:
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.
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.
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.
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”
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.
Here’s an elegant and modern way to move data from your Azure virtual machine to…
The effects of the recent Facebook data breach are still being felt. In this new…
Are you finally ready to take the plunge into Exchange 2019? If you are building…
A cyber-extortion scam targeting Google’s AdSense users is making waves. Here are the facts that…
Nobody likes a surprise in their cloud bills. This handy script will help you check…
This neat PowerShell tip will help you write more efficient scripts by showing you how…