Created
December 1, 2016 14:04
-
-
Save bobalob/a7f2cb19da6fae8b1383b99359edd92c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
configuration NewDomain | |
{ | |
param | |
( | |
[Parameter(Mandatory)] | |
[pscredential]$safemodeAdministratorCred, | |
[Parameter(Mandatory)] | |
[pscredential]$domainCred | |
) | |
Import-DscResource -ModuleName PSDesiredStateConfiguration | |
Import-DscResource -ModuleName xActiveDirectory | |
Node $AllNodes.Where{$_.Role -eq "Primary DC"}.Nodename | |
{ | |
LocalConfigurationManager | |
{ | |
ActionAfterReboot = 'ContinueConfiguration' | |
ConfigurationMode = 'ApplyOnly' | |
RebootNodeIfNeeded = $true | |
} | |
File ADFiles | |
{ | |
DestinationPath = 'C:\NTDS' | |
Type = 'Directory' | |
Ensure = 'Present' | |
} | |
WindowsFeature ADDSInstall | |
{ | |
Ensure = "Present" | |
Name = "AD-Domain-Services" | |
} | |
# Optional GUI tools | |
WindowsFeature ADDSTools | |
{ | |
Ensure = "Present" | |
Name = "RSAT-ADDS" | |
} | |
# No slash at end of folder paths | |
xADDomain FirstDS | |
{ | |
DomainName = $Node.DomainName | |
DomainAdministratorCredential = $domainCred | |
SafemodeAdministratorPassword = $safemodeAdministratorCred | |
DatabasePath = 'C:\NTDS' | |
LogPath = 'C:\NTDS' | |
DependsOn = "[WindowsFeature]ADDSInstall","[File]ADFiles" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment