Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Configure-ADForest.ps1 PowerShell script used by CloudFormation template to deploy Active Directory Domain Services
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)]
[string]$DomainName,
[Parameter(Mandatory=$true)]
[string]$DomainNetBiosName,
[Parameter(Mandatory=$true)]
[string]$DomainMode,
[Parameter(Mandatory=$true)]
[string]$ForestMode,
[Parameter(Mandatory=$true)]
[string]$SafeModeAdministratorPassword
)
# Create New Forest, add Domain Controller
Import-Module ADDSDeployment
#Convert the SafeModeAdministratorPassword to a secureString
$SecuredSafeModeAdministratorPassword = ConvertTo-SecureString -String $SafeModeAdministratorPassword -AsPlainText -Force
Install-ADDSForest -CreateDnsDelegation:$false `
-DomainName $DomainName `
-DomainNetbiosName $DomainNetbiosName `
-DatabasePath "C:\Windows\NTDS" `
-DomainMode $DomainMode `
-ForestMode $ForestMode `
-SafeModeAdministratorPassword $SecuredSafeModeAdministratorPassword `
-InstallDns:$true `
-LogPath "C:\Windows\NTDS" `
-NoRebootOnCompletion:$false `
-SysvolPath "C:\Windows\SYSVOL" `
-Force:$true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.