forked from dsccommunity/ActiveDirectoryDsc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
2-ADObjectEnabledState_CreateClusterComputerAccount_Config.ps1
63 lines (55 loc) · 1.81 KB
/
2-ADObjectEnabledState_CreateClusterComputerAccount_Config.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<#PSScriptInfo
.VERSION 1.0.1
.GUID b4d414dc-e230-4055-bdc3-fae268493881
.AUTHOR DSC Community
.COMPANYNAME DSC Community
.COPYRIGHT DSC Community contributors. All rights reserved.
.TAGS DSCConfiguration
.LICENSEURI https://github.com/dsccommunity/ActiveDirectoryDsc/blob/main/LICENSE
.PROJECTURI https://github.com/dsccommunity/ActiveDirectoryDsc
.ICONURI https://dsccommunity.org/images/DSC_Logo_300p.png
.RELEASENOTES
Updated author, copyright notice, and URLs.
#>
#Requires -Module ActiveDirectoryDsc
#Requires -Module xFailoverCluster
<#
.DESCRIPTION
This configuration will create a computer account disabled, configure
a cluster using the disabled computer account, and enforcing the
computer account to be enabled.
#>
Configuration ADObjectEnabledState_CreateClusterComputerAccount_Config
{
param
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.Management.Automation.PSCredential]
$Credential
)
Import-DscResource -ModuleName ActiveDirectoryDsc
Import-DscResource -ModuleName xFailoverCluster -ModuleVersion '1.14.1'
node localhost
{
ADComputer 'ClusterAccount'
{
ComputerName = 'CLU_CNO01'
EnabledOnCreation = $false
}
xCluster 'CreateCluster'
{
Name = 'CLU_CNO01'
StaticIPAddress = '192.168.100.20/24'
DomainAdministratorCredential = $Credential
DependsOn = '[ADComputer]ClusterAccount'
}
ADObjectEnabledState 'EnforceEnabledPropertyToEnabled'
{
Identity = 'CLU_CNO01'
ObjectClass = 'Computer'
Enabled = $true
DependsOn = '[xCluster]CreateCluster'
}
}
}