# NAME: create-Cluster.ps1 # # AUTHOR: Robert Smit # EMAIL: robert.smit@aca-computers.nl # # COMMENT: Script to create a Cluster. # # # You have a royalty-free right to use, modify, reproduce, and # distribute this script file in any way you find useful, provided that # you agree that the creator, owner above has no warranty, obligations, # or liability for such use. # # VERSION HISTORY: # 1.0 7.10.2010 - Initial release # ########################################################################### #Importing Microsoft`s PowerShell-modules Write-Host "Install System Modules" -ForegroundColor yellow ImportSystemModules #Add-WindowsFeature Write-Host "Add Failover Clustering" -ForegroundColor yellow Add-WindowsFeature Failover-Clustering #Importing Microsoft`s PowerShell-module for administering NLB Clusters Write-Host "Install ServerManager Modules" -ForegroundColor yellow Import-Module ServerManager #Variables for creating the new cluster Write-Host "Cluster Properties Hostname / Node Names" -ForegroundColor yellow $Clusternode1 = Read-Host "Enter ClusterNode 1 for the new cluster" $Clusternode2 = Read-Host "Enter ClusterNode 2 for the new cluster" $ClusterFqdn = Read-Host "Enter Cluster for the new cluster" $ClusterIP = Read-Host "Enter cluster primary IP" #Clear old Cluster info Write-Host "Old Cluster Configuration Will Be ereased just to make sure" -ForegroundColor yellow Clear-ClusterNode $Clusternode1 -force Clear-ClusterNode $Clusternode2 -force #Validating new cluster Write-Host "Validate Windows 2008 R2 Cluster..." -ForegroundColor yellow Test-Cluster $Clusternode1 -ignore network,inventory,storage #Creating new cluster Write-Host "Create Windows 2008 R2 Cluster..." -ForegroundColor yellow New-Cluster -Node "$Clusternode1" -Name $ClusterFqdn -NoStorage -StaticAddress "$ClusterIP" #Show Cluster Disk Available Write-Host "Show Cluster Disk Available..." -ForegroundColor yellow Get-ClusterAvailableDisk #Show Wittness Disk Capable Write-Host "Show Wittness disk for Cluster Available..." -ForegroundColor yellow Get-ClusterAvailableDisk | ?{ $_.Size -lt 1573741824} # Place the Wittness disk Write-Host "Choose a Wittness disk for the Windows 2008 R2 Cluster... Must be "Cluster Disk # "" -ForegroundColor yellow $ClusterQuorumdisk = Read-Host "Enter Wittness disk Cluster Disk numer" # Add disks to the Cluster Write-Host "Add disks to Windows 2008 R2 Cluster..." -ForegroundColor yellow Get-ClusterAvailableDisk | Add-ClusterDisk #Show Wittness Disk Capable Write-Host "Show Wittness disk for Cluster Available..." -ForegroundColor yellow Get-ClusterAvailableDisk | ?{ $_.Size -lt 1573741824} Start-Sleep -Seconds 5 # Change the quorum model Write-Host "Change the Quorum model Windows 2008 R2 Cluster..." -ForegroundColor yellow Set-ClusterQuorum -NodeAndDiskMajority $ClusterQuorumdisk # Add Cluster node Write-Host "Add Cluster node to Windows 2008 R2 Cluster..." -ForegroundColor yellow Add-Clusternode $Clusternode2