Last active
February 7, 2020 15:46
-
-
Save thefamousbrian/0f4794b48f466cdbe09ec7b7525006fa to your computer and use it in GitHub Desktop.
DSC Script resource to create a new failover cluster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Script NewCluster { | |
TestScript = { | |
$computerObject = Get-CimInstance -ClassName Win32_ComputerSystem | |
$cluster = Get-Cluster -Name $Using:clustername -Domain $computerObject.Domain | |
if($cluster) { | |
return $true | |
} else { | |
return $false | |
} | |
} | |
GetScript = { } | |
SetScript = { | |
$staticIPs = New-Object System.Collections.Specialized.StringCollection | |
$staticIPs.Add($ECRM_SQL01_CLUSTER_IP) | |
$staticIPs.Add($ECRM_SQL02_CLUSTER_IP) | |
$clusterNodes = New-Object System.Collections.Specialized.StringCollection | |
$clusterNodes.Add($ECRM_SQL01_HOSTNAME) | |
$clusterNodes.Add($ECRM_SQL02_HOSTNAME) | |
New-Cluster -Name CRMEXAMPLE -Node $clusterNodes -StaticAddress $staticIPs -NoStorage -Force | |
} | |
PsDscRunAsCredential = $crmAdminCred | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment