In this blog post, I will show you how to deploy a new Active Directory forest on Windows Server Core 2019 using a PowerShell script.
Windows Server Core 2019
The core version of Windows Server comes without the desktop experience (GUI) and offer a light and more secure operating system that requires less patching and management.
The latest release of Windows Server core 2019 and comes with a new feature called Server Core App Compatibility Feature on Demand (FOD) that allows us to install more features of Windows Server desktop experience.
The following PowerShell script will install a new Active Directory forest and domain.
When you run the script, you will be asked to provide a safe mode which is also the password for the domain administrator account.
Fill in the details for your domain name and NetBIOS name.
Save the script and run it.
$pass = Read-Host -Prompt "Set Safe Mode Administrator Password" -AsSecureString Install-windowsfeature AD-domain-services ADD-WindowsFeature RSAT-Role-Tools Add-WindowsFeature gpmc Import-Module ADDSDeployment Install-ADDSForest ` -DomainName "corp.yourdomainname.local" ` -DomainNetbiosName "corp" ` -SafeModeAdministratorPassword $pass` -InstallDns:$true ` -NoRebootOnCompletion:$false ` -SysvolPath "C:\Windows\SYSVOL" ` -Force:$true
After saving the script, run it from the server core console by typing PowerShell first and the name of the script.
Note: You can start notepad by typing notepad and copy-paste the script and save it on the desktop.
The installation will take a few minutes to complete, and when completed, the server will restart.
After reboot, login with the using the domain administrator account and the password you set.