From 30222ef2c9c57f1457da77700420545249d8f738 Mon Sep 17 00:00:00 2001 From: Olivier Gaudefroy Date: Mon, 28 Jul 2014 12:07:42 +0200 Subject: [PATCH] Fixed Failover clustering setup on Windows Server 2012. --- AutomatedDeployments/SQL/ProvisionSqlVm.ps1 | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/AutomatedDeployments/SQL/ProvisionSqlVm.ps1 b/AutomatedDeployments/SQL/ProvisionSqlVm.ps1 index dbd9f5e..8029bfb 100644 --- a/AutomatedDeployments/SQL/ProvisionSqlVm.ps1 +++ b/AutomatedDeployments/SQL/ProvisionSqlVm.ps1 @@ -86,7 +86,22 @@ Invoke-Command -ComputerName $uris[0].DnsSafeHost -Credential $localAdminCredent { Write-Host "Installing Failover-Clustering feature" Import-Module ServerManager - Add-WindowsFeature 'Failover-Clustering', 'RSAT-Clustering' + $OsBuildNumber = [System.Environment]::OSVersion.Version.Build + if ($OsBuildNumber -lt 7600) + { + Write-Error "Not support on Windows Visa or lower" + exit 1 + } + elseif ($OsBuildNumber -lt 9200) + { + Write-Output "Windows Server 2008 R2 detected" + Add-WindowsFeature 'Failover-Clustering', 'RSAT-Clustering' + } + else + { + Write-Output "Windows Server 2012 or above detected" + Add-WindowsFeature 'Failover-Clustering', 'RSAT-Clustering-PowerShell', 'RSAT-Clustering-CmdInterface' + } } else {