Share via


Enabling the Failover Clustering Feature on Windows Server 2008 R2 Server Core

One of the biggest challenges when using Windows Server Core apart from the obvious ones introduced by the reduced graphical interface is to overcome those challenges displayed by its nuances. Tasks that you can perform easily from the command line on a Non-Core edition of Windows might not be possible in exactly the same way as you would have previously done.

One such example of a Server Core nuance can be seen when attempting to enable the Failover Clustering feature. On any edition of Windows, once this feature has been enabled, it allows access to Failover Clustering command line executables, makes available the failoverclusters module to PowerShell and makes it possible for the Server to join and become a node a Windows Server Failover Cluster (WSFC). Should you wish to install a new SQL Server Failover Clustered Instance (FCI) on this node or add the node to an existing SQL FCI then you must enable the Failover Clustering feature before doing so.

Luckily, like nearly every operation in Windows there are multiple ways to do so (on Server Core), but we shall focus on probably the most obvious route -by using PowerShell. On a Non-Core edition of Windows this operation is incredibly simple through PowerShell. We simply first have to import the servermanager module to make accessible the get-windowsfeature and add-windowsfeature cmdlets. Once these are accessible, it is possible to enable the failover-clustering Windows feature. Utilizing the failoverclusters module cmdlets through PowerShell is then achieved simply by importing the failoverclusters module. It is probably a good time to point out that by default, PowerShell support is disabled on Windows 2008R2 Server Core so in order to use it you must first enable it through the sconfig utility or in exactly the same way described for enabling other features below. We shall assume that this has already been addressed.

We can demonstrate enabling the failover-clustering feature on a Non-Server Core edition by using this following example :-
**C:\powershell
PS C:\import-module servermanager
PS C:\add-windowsfeature failover-clustering
PS C:\import-module failoverclusters
**

So performing that operation was fairly straight forward, but there is one slight problem -on Server Core the servermanager feature is not enabled by default. This means that we are not able to import the servermanager module and therefore unable to utilize the get-windowsfeature and add-windowsfeature cmdlets. The net result? It is not possible to enable the failover-clustering feature through PowerShell without first having the servermanager feature enabled.

Thankfully Windows Server Core provides many ways to enable Windows Features. One way could be to use the tools provided by Windows 2008 Server Core such as oclist and ocsetup. Alternatively the more powerful and unified tool provided by Windows 2008R2 could also be preferred, and this is called dism.
Now we know that it is possible to enable Windows features without requiring PowerShell, we have essentially one of two choices to make. The first would be to enable the failover-clustering feature directly using dism (or ocsetup) which could be desirable should you never wish to add, remove or get Windows features through PowerShell. The second option would be to first enable the servermanager feature on Server Core allowing us to simply run through the previous script listed earlier to enable the failover-clustering feature (or any other available feature) through PowerShell.

To do this we simply have to run the following code from the command line :-
C:\dism /online /enable-feature:ServerManager-PSH-Cmdlets

I think you will agree that whilst using command line tools and PowerShell from Server Core are not inherently difficult to use and automate, it is important to be aware of the subtle differences that Windows Server Core throws up from time to time. When you encounter them, there is almost certainly going to be workarounds available to you. The difficulty is sometimes in simply recognising that they are needed and which route to take.