使用 PowerShell 安装 Active Directory

2022_07_06_15_33_40.png


当前环境:Windows Server 2016


安装 ADDSDeployment 和 DNS

Install-WindowsFeature -Name AD-Domain-Services, DNS -IncludeManagementTools


设置静态 IP


Jump 使用 PowerShell 配置静态 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


  • CreateDnsDelegation: 创建 DNS 委托
  • DomainMode: 创建新林中第一域的域功能级别。INFO
  • ForestMode: 指定新林的林功能级别。INFO
  • InstallDns: 安装并配置新林的 DNS服务器服务
  • NoRebootOnCompletion: 在完成此命令后是否立即重新启动计算机


你可能感兴趣的:(使用 PowerShell 安装 Active Directory)