-
Notifications
You must be signed in to change notification settings - Fork 0
/
domainController.ps1
68 lines (58 loc) · 2.27 KB
/
domainController.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
64
65
66
67
68
#Requires -module @{ModuleName = 'xActiveDirectory';ModuleVersion = '3.0.0.0'}
#Requires -module @{ModuleName = 'xStorage'; ModuleVersion = '3.4.0.0'}
#Requires -module @{ModuleName = 'xPendingReboot'; ModuleVersion = '0.4.0.0'}
configuration domainController
{
Import-DscResource -ModuleName @{ModuleName = 'xActiveDirectory'; ModuleVersion = '3.0.0.0'}
Import-DscResource -ModuleName @{ModuleName = 'xStorage'; ModuleVersion = '3.4.0.0'}
Import-DscResource -ModuleName @{ModuleName = 'xPendingReboot'; ModuleVersion = '0.4.0.0'}
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
# When using with Azure Automation, modify these values to match your stored credential names
$domainCredential = Get-AutomationPSCredential 'localadmin'
node localhost
{
WindowsFeature ADDSInstall
{
Ensure = 'Present'
Name = 'AD-Domain-Services'
}
xWaitforDisk Disk2
{
DiskId = 2
RetryIntervalSec = 10
RetryCount = 30
}
xDisk DiskF
{
DiskId = 2
DriveLetter = 'F'
DependsOn = '[xWaitforDisk]Disk2'
}
xPendingReboot BeforeDC
{
Name = 'BeforeDC'
SkipCcmClientSDK = $true
DependsOn = '[WindowsFeature]ADDSInstall','[xDisk]DiskF'
}
# Configure domain values here
xADDomain Domain
{
DomainName = $configurationData.nonNodeData.domainName
DomainAdministratorCredential = $domainCredential
SafemodeAdministratorPassword = $domainCredential
DatabasePath = $configurationData.nonNodeData.databasePath
LogPath = $configurationData.nonNodeData.logPath
SysvolPath = $configurationData.nonNodeData.sysvolPath
DependsOn = '[WindowsFeature]ADDSInstall','[xDisk]DiskF','[xPendingReboot]BeforeDC'
}
Registry DisableRDPNLA
{
Key = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp'
ValueName = 'UserAuthentication'
ValueData = 0
ValueType = 'Dword'
Ensure = 'Present'
DependsOn = '[xADDomain]Domain'
}
}
}