Skip to content

Instantly share code, notes, and snippets.

@shanehoey
Last active January 21, 2023 04:56
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
New AD Forest

New AdForest

$servername =       "dc01"
$domainname =       "example.com"
$netbios    =       "example"
$ipaddress =        "192.168.10.248"
$prefixlenght =     "24"
$defaultgateway =   "192.168.10.254"
$ifindex =          (get-netadapter).ifindex

New-NetIPAddress -IPAddress $ipaddress -PrefixLength $prefixlenght -InterfaceIndex $ifindex -DefaultGateway $defaultgateway

rename-computer -newname $servername -force
restart-computer

Add-WindowsFeature "RSAT-AD-Tools" 
Add-WindowsFeature -Name "ad-domain-services" -IncludeAllSubFeature -IncludeManagementTools 
Add-WindowsFeature -Name "dns" -IncludeAllSubFeature -IncludeManagementTools 
Add-WindowsFeature -Name "gpmc" -IncludeAllSubFeature -IncludeManagementTools
restart-computer

Install-ADDSForest -CreateDnsDelegation:$false -DatabasePath "C:\Windows\NTDS" -DomainMode "Win2012" ` 
-DomainName $domainname -DomainNetbiosName $netbiosName -ForestMode "Win2016" -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