WSFC Health Checks for SQL Server DBAs: PowerShell and DMVs

A failover cluster instance restarts on another node at 03:00. The SQL Server error log shows the shutdown and the startup, but it may not say why the cluster moved the instance. The answer may be in the Windows Server Failover Cluster (WSFC) that hosts it: a node that went down, a partitioned network, or a quorum change. SQL Server exposes some of that through DMVs, and the rest is in the cluster itself.

A woman DBA listens with a stethoscope to one of three linked server towers while green heartbeat lines pulse between them, with a padlocked lever left untouched behind her.

For the why, you need the cluster log. These checks tell you the state now. This post covers the read-only checks I’d run from both sides: the PowerShell FailoverClusters cmdlets, and the DMVs SQL Server exposes. It ends with a T-SQL and PowerShell health check that returns a status row, not an error, on a machine with no cluster. For where FCIs and AGs fit among the other options, see SQL Server HA and DR Options: A Field Guide.

What I Could and Couldn’t Test

My workstation isn’t a cluster node. I ran the T-SQL on two local instances: SQL Server 2019 (15.0.4500.2, Developer) and SQL Server 2025 (17.0.5015.4, Enterprise Developer). Neither is a failover cluster instance (FCI) and neither has availability groups (AGs) enabled. I ran the PowerShell in Windows PowerShell 5.1 and PowerShell 7.6.

Everything I say about a real cluster comes from Microsoft Learn or from reflection on the module’s types, not from my own test. What I could measure is what each command does when there’s no cluster, and a script you push to every server has to cope with that.

For the AG layer itself (replica state, queues, failover readiness), see Availability Group Health Monitoring with AI and Mapping Availability Group Topology with AI.

The FailoverClusters Cmdlets

These are the cmdlets I’d use for a health check. All of them read state. The objects they return can change the cluster if you assign to a property, which I cover below.

Cmdlet What it reports
Get-Cluster Cluster-wide settings, including heartbeat thresholds and whether quorum is forced
Get-ClusterNode Each node and its state (Up, Down, Paused, Joining)
Get-ClusterQuorum The quorum configuration and the witness resource
Get-ClusterResource Each resource, its state, its owner group and its type
Get-ClusterNetwork Each cluster network, its state and its role
Get-ClusterLog Generates the cluster log on each node (this one writes files)

The Get-Cluster documentation says the cmdlet reports whether the cluster is in a forced quorum state, along with cross-network settings that matter for multi-site clusters. It also says you set a cluster property by getting the cluster object and setting the property on it directly.[1] Get-ClusterQuorum reports the quorum configuration, which determines how many failures the cluster can sustain before it stops.[2]

The state values in the table are the enum names I found by reflection on the module’s types. Networks can also be Partitioned or Unavailable, and resources have nine states, including Online, Offline and Failed.

Get-ClusterLog isn’t read-only: Learn says it creates a log file on each node, by default in C:\Windows\Cluster\Reports. -TimeSpan limits it to the last N minutes, and timestamps are in GMT unless you add -UseLocalTime. Remote use needs CredSSP.[3] It writes to every node, so I keep it behind a switch.

The Objects Are Writable

The objects these cmdlets return are bound to the cluster, and some properties are settable. Learn’s Get-ClusterNetwork page renames a cluster network by assigning to .Name on the returned object.[4] Reflection here lists 81 writable properties (out of 93) on the cluster object, including SameSubnetThreshold and DynamicQuorum. NodeWeight on a node and Role on a network are writable too. The script only reads properties and never assigns to one. What it displays goes through Select-Object, so the output rows are plain copies. The variables inside the script still hold the live objects, so be careful if you extend it.

Test-Cluster Is Not a Routine Check

Test-Cluster runs the failover cluster validation tests, grouped into categories such as Cluster, Inventory, Network, Storage and System. The storage tests can take a running role offline if you let them test its disks.

The cmdlet documentation says storage tests don’t test online disks that a clustered role is using. To test those disks you stop the role with Stop-ClusterGroup first. If you pass -Disk or -Pool with -Force, the disks or pool are taken offline for the duration of the storage tests. Some Cluster Shared Volume tests also create a local user account named CliTest2 on each node, and remove it afterwards.[5]

The hardware validation article says the wizard prompts you to take a clustered role offline if it’s using a disk when you start. If you agree, the role stays offline until the tests finish. It recommends keeping a small LUN that no clustered role uses, so you can run storage validation without taking roles offline.[6]

On a cluster that hosts an FCI, the role that owns the shared disks is the SQL Server instance. So I treat Test-Cluster as a change: schedule it, get approval, and leave out the Storage category with -Ignore unless you’ve planned the outage. Test-Cluster -List lists the test and category names. I didn’t run either form here.

What SQL Server Exposes

SQL Server has its own view of the cluster. The hadr views were built for AGs, and since SQL Server 2014 they also support FCIs. For read-scale AGs and AGs on Linux, which have no Windows cluster, the cluster columns may show data about an internal default cluster that you can disregard. Reading them needs VIEW SERVER STATE on SQL Server 2019 and earlier, or VIEW SERVER PERFORMANCE STATE on 2022 and later.[7]

Object What Learn says it returns
sys.dm_hadr_cluster One row with the cluster name, quorum type and quorum state, or no row if the node has no quorum
sys.dm_hadr_cluster_members One row per quorum member, nodes and witness, with its state and votes
sys.dm_hadr_cluster_networks One row per member taking part in an AG’s subnet configuration
sys.dm_os_cluster_nodes One row per node in the FCI configuration, empty if the instance isn’t an FCI
sys.dm_os_cluster_properties One row of FCI resource settings, no data on a stand-alone instance
SERVERPROPERTY('IsClustered') 1 for an FCI, 0 otherwise
SERVERPROPERTY('IsHadrEnabled') 1 if the AG feature is enabled

sys.dm_hadr_cluster_members reports a node that is down as down when you query it from a node that still has quorum. Learn says you can use it to work out how many more failures the cluster can tolerate in a node-majority quorum. The current page also lists a number_of_current_votes column, which reflects dynamic quorum and dynamic witness.[8] That column was there on my 2025 instance and not on 2019. sys.dm_hadr_cluster_networks is the one to check when you validate the subnet and virtual IP for each replica.[9]

For an FCI, sys.dm_os_cluster_nodes gives each node’s status (up, down, paused, joining) and which node owns the instance.[10] sys.dm_os_cluster_properties shows FailureConditionLevel, which sets the conditions under which the FCI should fail or restart (default 3). It also shows HealthCheckTimeout, how long the resource DLL waits for health information before it considers the instance unresponsive (default 60,000 ms). The page also lists a ClusterConnectionOptions column, which I saw on 2025 and not on 2019.[11]

What a Non-Clustered Instance Returns

On both local instances, every cluster view returned zero rows and no error.

Check SQL Server 2019 SQL Server 2025
sys.dm_hadr_cluster 0 rows 0 rows
sys.dm_hadr_cluster_members 0 rows 0 rows
sys.dm_hadr_cluster_networks 0 rows 0 rows
sys.dm_os_cluster_nodes 0 rows 0 rows
sys.dm_os_cluster_properties 0 rows 0 rows
IsClustered 0 0
IsHadrEnabled 0 0
HadrManagerStatus 2 2

HadrManagerStatus is 2 on both, which Learn defines as “Not started and failed.”[12] That’s the value here with the AG feature turned off, so on its own it doesn’t indicate a fault.

An empty result looks the same whether the instance has no cluster or the node has lost quorum. So a script should check IsClustered and IsHadrEnabled first, and only treat an empty sys.dm_hadr_cluster as a problem when one of them is 1.

In Windows PowerShell 5.1, Get-Module -ListAvailable FailoverClusters found version 2.0.0.0. In PowerShell 7.6 the same command returned nothing, and found the module only with -SkipEditionCheck. Importing it in 7.6 loaded it through the Windows PowerShell compatibility session (WinPSCompatSession), which runs the module in a background 5.1 process over implicit remoting.[13] Each cluster cmdlet then printed a warning about running remotely and CredSSP.

The five Get-* cmdlets I ran (all but Get-ClusterLog) failed with the same terminating error in both shells:

The message says the cluster service isn’t running, but this machine has no ClusSvc service at all. In 5.1 the inner exception was “There are no more endpoints available from the endpoint mapper.” So the script checks for ClusSvc first and catches ClusterEndpointNotRegistered by its error ID, not by the message text.

The T-SQL Check

I wrote it to avoid functions added in SQL Server 2017, such as CONCAT_WS, but I’ve tested it only on 2019 and 2025. When the instance isn’t an FCI and AGs are off, it returns one status row and stops. Otherwise it returns the cluster views and a list of findings: no quorum row, forced quorum, a quorum member down, or an FCI node that isn’t up.

On both local instances it returned the single status row. To exercise the rest, I ran a copy with @is_clustered forced to 1. Every query ran without error and returned zero rows, and the findings query reported “No quorum row.” So the cluster branch compiles and runs on both versions, but I haven’t seen its output on a real cluster.

The PowerShell Check

This runs in Windows PowerShell 5.1 or PowerShell 7. Without -ClusterName it checks the local machine, and it stops with an INFO row when ClusSvc isn’t installed. It emits a WARN row for any node or network that isn’t Up and any resource that isn’t Online. Expect WARN rows for resources you’ve left offline on purpose.

The state comparisons go through a string ("$($_.State)") because in PowerShell 7 the objects come back deserialized from the compatibility session. A nested object, such as the quorum resource, may arrive as a string there, so the quorum row converts Cluster and QuorumResource to strings too. On a live object that still gives the name: reflection shows both types inherit a ToString() that returns Name. The property names come from the module’s type definitions on my workstation. I ran the script four ways: in both shells, with and without -ClusterName localhost.

On a real cluster I’d expect the summary objects followed by any WARN rows, but I haven’t seen that output. Run it on a test cluster before you schedule it.

Limits

  • I tested on one workstation with no cluster. The cluster-present paths of both scripts have not run against a real WSFC, so treat property names, state values and the PowerShell 7 deserialized output there as untested.
  • I didn’t run Test-Cluster or Get-ClusterLog. What they do on a cluster comes from Microsoft Learn.
  • The FailoverClusters module here is version 2.0.0.0 on Windows 11. A server’s module may differ.
  • I didn’t test an AG with CLUSTER_TYPE = NONE or EXTERNAL, where Learn says the cluster columns may describe an internal default cluster.

Related: Setting Up and Monitoring Log Shipping with T-SQL.

If you run these checks on a real cluster and see something different, or you’ve had Test-Cluster take a role offline when you didn’t expect it, I’d like to hear about it. Find me on Bluesky or LinkedIn.

References

  1. Get-Cluster (FailoverClusters) - Microsoft Learn. Says the cmdlet reports forced quorum state and cross-network settings, and that you set a cluster property by setting it on the returned object. ↩
  2. Get-ClusterQuorum (FailoverClusters) - Microsoft Learn. Describes the quorum configuration as what determines how many failures the cluster can sustain. ↩
  3. Get-ClusterLog (FailoverClusters) - Microsoft Learn. Says the cmdlet creates a log on each node in C:\Windows\Cluster\Reports by default, documents -TimeSpan, -Destination and -UseLocalTime (GMT by default), and notes the CredSSP requirement for remote use. ↩
  4. Get-ClusterNetwork (FailoverClusters) - Microsoft Learn. Example 2 renames a cluster network by assigning to the Name property of the returned object. ↩
  5. Test-Cluster (FailoverClusters) - Microsoft Learn. Says storage tests skip online disks in use by a clustered role, that -Force with -Disk or -Pool takes disks or pools offline for the storage tests, and that some CSV tests create a CliTest2 account on each node. ↩
  6. Validate hardware for a failover cluster - Microsoft Learn. Says the wizard prompts to take a clustered role that uses a disk offline, that the role stays offline until the tests finish, and recommends a spare LUN for storage validation. ↩
  7. sys.dm_hadr_cluster (Transact-SQL) - Microsoft Learn. Returns one row with cluster name and quorum details, or no row without quorum. Notes FCI support from SQL Server 2014, the internal default cluster for clusterless AGs, and the permissions. ↩
  8. sys.dm_hadr_cluster_members (Transact-SQL) - Microsoft Learn. One row per quorum member including the witness, down nodes reported from a node with quorum, and the number_of_current_votes column. ↩
  9. sys.dm_hadr_cluster_networks (Transact-SQL) - Microsoft Learn. One row per cluster member taking part in an AG’s subnet configuration, used to validate each replica’s network virtual IP. ↩
  10. sys.dm_os_cluster_nodes (Transact-SQL) - Microsoft Learn. One row per FCI node with status and current owner, and an empty rowset when the instance isn’t an FCI. ↩
  11. sys.dm_os_cluster_properties (Transact-SQL) - Microsoft Learn. One row of FCI resource properties, no data on a stand-alone instance, with defaults for FailureConditionLevel and HealthCheckTimeout and the ClusterConnectionOptions column. ↩
  12. SERVERPROPERTY (Transact-SQL) - Microsoft Learn. Defines IsClustered, IsHadrEnabled, and HadrManagerStatus, where 2 means “Not started and failed.” ↩
  13. about_Windows_PowerShell_Compatibility - Microsoft Learn. Describes the WinPSCompatSession, which runs Windows PowerShell modules in a background 5.1 process over implicit remoting. ↩