Execution Flow
Synopsis
Queries the local or remote Windows Server Failover Cluster (WSFC) using the FailoverClusters PowerShell module. Returns all cluster nodes with their state and vote weight, plus all cluster roles with their owner node and virtual IP addresses. The FailoverClusters module is auto-installed via RSAT if missing (Server: Install-WindowsFeature RSAT-Clustering-PowerShell; Client: Add-WindowsCapability Rsat.Clustering). The auto-install can be suppressed with -NoAutoInstall.
No dbatools required. No ShouldProcess (read-only). Always Storage and Cluster Group roles are excluded from the Roles list by default to reduce noise.
Syntax
Get-sqmClusterInfo [-ComputerName <String>] [-NoAutoInstall] [-IncludeClusterGroup] [-EnableException]
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| -NoAutoInstall | Switch | false | Suppress automatic RSAT installation. Throws if the FailoverClusters module is missing. |
| -EnableException | Switch | false | Throw terminating exceptions instead of writing errors. |
| -ClusterName | string | , | The name of the cluster to query. If not specified, the function attempts to determine the local cluster (only meaningful on a cluster node). |
| -IncludeCoreGroup | switch | $false | Switch to include the core cluster group ("Cluster Group") in the roles list. Storage groups are always excluded. |
Return Value
Single [PSCustomObject]:
| Property | Description |
|---|---|
| Success | Boolean, false if cluster not found or module install failed. |
| ErrorMessage | Error text when Success = false. |
| ClusterName | Cluster name from Get-Cluster. |
| Nodes | Array of PSCustomObject: NodeName, State (Up/Down/Paused), NodeWeight. |
| Roles | Array of PSCustomObject: Name, State, OwnerNode, IPAddresses[]. |
Examples
Example 1, Query local cluster
Get-sqmClusterInfoExample 2, Query a specific node, include Cluster Group role
Get-sqmClusterInfo -ComputerName "SQL01" -IncludeClusterGroupExample 3, Show all IP addresses of all roles
(Get-sqmClusterInfo).Roles | Select-Object Name, IPAddressesExample 4, Suppress RSAT auto-install (required on locked-down servers)
Get-sqmClusterInfo -NoAutoInstall -EnableException