Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sunilake/29d7baaf7afd032bea6f4a92d1c94bc5 to your computer and use it in GitHub Desktop.
Save sunilake/29d7baaf7afd032bea6f4a92d1c94bc5 to your computer and use it in GitHub Desktop.
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