Add windows-ad/populate_ad/install.ps1
This commit is contained in:
parent
66c942f679
commit
8807c1a356
|
@ -0,0 +1,33 @@
|
||||||
|
# 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
|
||||||
|
$DomainName = "${domain_name}"
|
||||||
|
$DomainNetBiosName = "${domain_netbios_name}"
|
||||||
|
$SafeModePassword = ConvertTo-SecureString -AsPlainText "${safe_mode_password}" -Force
|
||||||
|
$DomainAdminPassword = ConvertTo-SecureString -AsPlainText "${domain_admin_password}" -Force
|
||||||
|
|
||||||
|
# https://learn.microsoft.com/en-us/powershell/module/addsdeployment/install-addsforest?view=windowsserver2022-ps
|
||||||
|
$HashArguments = @{
|
||||||
|
# DatabasePath = "d:\NTDS"
|
||||||
|
# LogPath = "e:\Logs"
|
||||||
|
# SysvolPath = "d:\SYSVOL"
|
||||||
|
DomainMode = "${domain_mode}"
|
||||||
|
DomainName = $DomainName
|
||||||
|
DomainNetBiosName = $DomainNetBiosName
|
||||||
|
SafeModeAdministratorPassword = $SafeModePassword
|
||||||
|
ForestMode = "${forest_mode}"
|
||||||
|
InstallDns = $true
|
||||||
|
Force = $true
|
||||||
|
}
|
||||||
|
|
||||||
|
Install-ADDSForest @HashArguments
|
||||||
|
|
||||||
|
|
||||||
|
Write-Output "AD DS installation complete. Domain created: $DomainName"
|
Loading…
Reference in New Issue