Windows Server 2022 Failover Cluster using PowerShell
for SQL Server Always On Availability Groups
Table of Contents
- 1. Prerequisites
- 2. Install Failover Clustering Feature
- 3. Import Module & Validate Cluster
- 4. Create the Cluster
- 5. Verify Cluster Configuration
- 6. Add Witness
0. Environment
| Node | Hostname | IP Address |
|---|---|---|
| DB Node 1 | NTICBPSQLSGV01 | 192.168.2.21 |
| DB Node 2 | NTICBPSQLSGV02 | 192.168.2.22 |
| DB Node 3 | NTICBPSQLSGV03 | 192.168.2.23 |
| DB Node 4 | NTICBPSQLSGV04 | 192.168.2.24 |
| Cluster Name | NTICBPSQLSGC05 | 192.168.2.25 |
| DC | DC01 | 192.168.2.20 |
1. Prerequisites
- All four servers must run Windows Server 2022.
- All servers must be joined to the same Active Directory domain.
- Ensure proper DNS name resolution between all nodes.
- Verify network connectivity and configure static IP addresses.
- Install the latest Windows updates and vendor drivers.
2. Install Failover Clustering Feature
Run the following command on each node as Administrator.
On NTICBPSQLSGV01
PS C:\Users\Administrator> Install-WindowsFeature -Name Failover-Clustering -IncludeManagementTools
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True No Success {Failover Clustering, Remote Server Admini...
PS C:\Users\Administrator> hostname
NTICBPSQLSGV01
PS C:\Users\Administrator>
PS C:\Users\Administrator> Get-WindowsFeature -Name Failover-Clustering
Display Name Name Install State
------------ ---- -------------
[X] Failover Clustering Failover-Clustering Installed
PS C:\Users\Administrator>On NTICBPSQLSGV02
PS C:\Users\Administrator> Install-WindowsFeature -Name Failover-Clustering -IncludeManagementTools
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True No Success {Failover Clustering, Remote Server Admini...
PS C:\Users\Administrator> hostname
NTICBPSQLSGV02
PS C:\Users\Administrator> Get-WindowsFeature -Name Failover-Clustering
Display Name Name Install State
------------ ---- -------------
[X] Failover Clustering Failover-Clustering Installed
PS C:\Users\Administrator>On NTICBPSQLSGV03
PS C:\Users\Administrator> Install-WindowsFeature -Name Failover-Clustering -IncludeManagementTools
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True No Success {Failover Clustering, Remote Server Admini...
PS C:\Users\Administrator> hostname
NTICBPSQLSGV03
PS C:\Users\Administrator> Get-WindowsFeature -Name Failover-Clustering
Display Name Name Install State
------------ ---- -------------
[X] Failover Clustering Failover-Clustering Installed
PS C:\Users\Administrator>On NTICBPSQLSGV04
PS C:\Users\Administrator> Install-WindowsFeature -Name Failover-Clustering -IncludeManagementTools
Success Restart Needed Exit Code Feature Result
------- -------------- --------- --------------
True No Success {Failover Clustering, Remote Server Admini...
PS C:\Users\Administrator> hostname
NTICBPSQLSGV04
PS C:\Users\Administrator> Get-WindowsFeature -Name Failover-Clustering
Display Name Name Install State
------------ ---- -------------
[X] Failover Clustering Failover-Clustering Installed
PS C:\Users\Administrator>
3. Import Cluster Module and Validate Cluster Configuration
On NTICBPSQLSGV01
Load the Windows Failover Clustering PowerShell module into your current PowerShell session.
Run validation before creating the cluster:
On NTICBPSQLSGV01: PS C:\Users\Administrator> hostname NTICBPSQLSGV01 PS C:\Users\Administrator> Import-Module FailoverClusters PS C:\Users\Administrator> PS C:\Users\Administrator> Test-Cluster -Node NTICBPSQLSGV01,NTICBPSQLSGV02,NTICBPSQLSGV03,NTICBPSQLSGV04 WARNING: System Configuration - Validate Software Update Levels: The test reported some warnings.. WARNING: Network - Validate Network Communication: The test reported some warnings.. WARNING: Test Result: HadUnselectedTests, ClusterConditionallyApproved Testing has completed for the tests you selected. You should review the warnings in the Report. A cluster solution is supported by Microsoft only if you run all cluster validation tests, and all tests succeed (with or without warnings). Test report file path: C:\Users\Administrator\AppData\Local\Temp\2\Validation Report 2025.12.29 At 18.28.44.htm Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 12/29/2025 6:34 PM 1346352 Validation Report 2025.12.29 At 18.28.44.htm PS C:\Users\Administrator>
Always review the cluster validation report.
4. Create the Cluster
New-Cluster ` -Name NTICBPSQLSGC05 ` -Node NTICBPSQLSGV01,NTICBPSQLSGV02,NTICBPSQLSGV03,NTICBPSQLSGV04 ` -StaticAddress 192.168.2.25 ` -NoStorage PS C:\Users\Administrator> New-Cluster ` >> -Name NTICBPSQLSGC05 ` >> -Node NTICBPSQLSGV01,NTICBPSQLSGV02,NTICBPSQLSGV03,NTICBPSQLSGV04 ` >> -StaticAddress 192.168.2.25 ` >> -NoStorage Name ---- NTICBPSQLSGC05 PS C:\Users\Administrator>
5. Verify Cluster Configuration
Cluster Name
PS C:\Users\Administrator> Get-Cluster Name ---- NTICBPSQLSGC05 PS C:\Users\Administrator>
Cluster Nodes
PS C:\Users\Administrator> Get-ClusterNode Name State Type ---- ----- ---- NTICBPSQLSGV01 Up Node NTICBPSQLSGV02 Up Node NTICBPSQLSGV03 Up Node NTICBPSQLSGV04 Up Node PS C:\Users\Administrator>
Cluster Resources
PS C:\Users\Administrator> Get-ClusterResource Name State OwnerGroup ResourceType ---- ----- ---------- ------------ Cluster IP Address Online Cluster Group IP Address Cluster Name Online Cluster Group Network Name PS C:\Users\Administrator>
Cluster Network
PS C:\Users\Administrator> Get-ClusterNetwork | Format-Table Name, Address, Role, State Name Address Role State ---- ------- ---- ----- Cluster Network 1 192.168.2.0 ClusterAndClient Up PS C:\Users\Administrator>

6. Add Witness
In this test lab environment, the File Share Witness (FSW) is hosted on the Domain Controller (DC).
Using a Domain Controller as File Share Witness is NOT recommended for production.
- In production, the File Share Witness should be hosted on:
- A dedicated file server
- Azure Cloud Witness (recommended)
- The witness folder must have Full Control for:
- The Windows Failover Cluster computer object
- SQL Server Always On cluster name object
Caution: Your use of any information or materials on this website is entirely at your own risk. It is provided for educational purposes only. It has been tested internally, however, we do not guarantee that it will work for you. Ensure that you run it in your test environment before using.
Thank you,
Rajasekhar Amudala
Email: br8dba@gmail.com
Linkedin: https://www.linkedin.com/in/rajasekhar-amudala/
