使用 PowerShell 安装 Active Director
2022-07-06 本文已影响0人
夙小叶
![](https://img.haomeiwen.com/i11192383/12b030ba32e6f251.png)
当前环境:Windows Server 2016
安装 ADDSDeployment
和 DNS
Install-WindowsFeature -Name AD-Domain-Services, DNS -IncludeManagementTools
设置静态 IP
安装 Active Directory
设置 SafeMode Admin Password
$Password = Read-Host -Prompt 'Enter SafeMode Admin Password' -AsSecureString
安装
Install-ADDSForest -CreateDnsDelegation:$false -DatabasePath "C:\Windows\NTDS" -DomainMode WinThreshold -DomainName "hcorp.local" -DomainNetbiosName "hcorp" -ForestMode WinThreshold -InstallDns:$true -LogPath "C:\Windows\NTDS" -NoRebootOnCompletion:$true -SafeModeAdministratorPassword $Password -SysvolPath "C:\Windows\SYSVOL" -Force:$true
或者
$Params = @{
CreateDnsDelegation = $false
DatabasePath = 'C:\Windows\NTDS'
DomainMode = 'WinThreshold'
DomainName = 'hcorp.local'
DomainNetbiosName = 'hcorp'
ForestMode = 'WinThreshold'
InstallDns = $true
LogPath = 'C:\Windows\NTDS'
NoRebootOnCompletion = $true
SafeModeAdministratorPassword = $Password
SysvolPath = 'C:\Windows\SYSVOL'
Force = $true
}
Install-ADDSForest @Params