2024-11-14 18:33:06 +00:00
|
|
|
# PowerShell script to install AD DS and configure a domain
|
|
|
|
Write-Output "Starting AD DS installation..."
|
|
|
|
|
|
|
|
# Install AD DS role
|
|
|
|
Install-WindowsFeature -Name AD-Domain-Services -IncludeManagementTools
|
|
|
|
|
|
|
|
# Import AD module
|
|
|
|
Import-Module ADDSDeployment
|
|
|
|
|
|
|
|
# Configure new domain
|
|
|
|
# https://learn.microsoft.com/en-us/powershell/module/addsdeployment/install-addsforest?view=windowsserver2022-ps
|
|
|
|
$HashArguments = @{
|
|
|
|
# DatabasePath = "d:\NTDS"
|
|
|
|
# LogPath = "e:\Logs"
|
|
|
|
# SysvolPath = "d:\SYSVOL"
|
2024-11-14 18:44:09 +00:00
|
|
|
DomainMode = $DomainMode
|
2024-11-14 18:33:06 +00:00
|
|
|
DomainName = $DomainName
|
|
|
|
DomainNetBiosName = $DomainNetBiosName
|
|
|
|
SafeModeAdministratorPassword = $SafeModePassword
|
2024-11-14 18:44:09 +00:00
|
|
|
ForestMode = $ForestMode
|
2024-11-14 18:33:06 +00:00
|
|
|
InstallDns = $true
|
|
|
|
Force = $true
|
|
|
|
}
|
|
|
|
|
|
|
|
Install-ADDSForest @HashArguments
|
|
|
|
|
|
|
|
Write-Output "AD DS installation complete. Domain created: $DomainName"
|