安装ActiveDirectory域服务(级别100)

适用范围:Windows Server 2022、Windows Server 2019、Windows Server 2016、Windows Server 2012 R2、Windows Server 2012

本主题讲解如何使用以下任一方法在 Windows Server 2012 中安装 AD DS:

运行 Adprep.exe 和安装 Active Directory 域服务的凭据要求

需要以下凭据才能运行 Adprep.exe 和安装 AD DS。

  • 若要安装新林,必须以该计算机的本地管理员身份登录。

  • 若要安装新子域或新域树,必须以 Enterprise Admins 组成员身份登录。

  • 若要在现有域中安装其他域控制器,必须是 Domain Admins 组的成员。

    注意

    如果未单独运行 adprep.exe 命令,且要在现有域或林中安装运行 Windows Server 2012 的第一个域控制器,系统将提示你提供凭据以运行 Adprep 命令。 凭据要求如下:

    • 若要在林中推出第一个 Windows Server 2012 域控制器,需要提供托管架构主机的域中的企业管理员组、架构管理员组和域管理员组的成员凭据。

    • 若要在域中推出第一个 Windows Server 2012 域控制器,需要提供域管理员组的成员凭据。

    • 若要在林中推出第一个只读域控制器 (RODC),需要提供 Enterprise Admins 组的成员凭据。

      注意

      如果已在 Windows Server 2008 或 Windows Server 2008 R2 中运行 adprep /rodcprep,则无需针对 Windows Server 2012 重新运行。

使用 Windows PowerShell 安装 AD DS

从 Windows Server 2012 开始,可以使用 Windows PowerShell 安装 AD DS。 Dcpromo.exe 自 Windows Server 2012 起开始弃用,但仍可以使用答案文件(dcpromo /unattend:<answerfile> 或 dcpromo /answer:<answerfile>)运行 dcpromo.exe。 可使用应答文件继续运行 dcpromo.exe 的功能让在现有自动化方面具有资源投入的组织有时间将自动化从 dcpromo.exe 转换为 Windows PowerShell。 有关使用答案文件运行 dcpromo.exe 的详细信息,请参阅 https://support.microsoft.com/kb/947034

开始使用 Windows PowerShell 添加角色。 此命令将安装 AD DS 服务器角色并安装 AD DS 和 AD LDS 服务器管理工具,包括基于 GUI 的工具(如 Active Directory 用户和计算机)和命令行工具(如 dcdia.exe)。 使用 Windows PowerShell 时,默认情况下不安装服务器管理工具。 你需要指定 “IncludeManagementTools 来管理本地服务器或安装远程服务器管理工具,以管理远程服务器。

Install-WindowsFeature -name AD-Domain-Services -IncludeManagementTools <<Windows PowerShell cmdlet and arguments>> 

仅当 AD DS 安装完成后,才需要重新启动。

接着,可以运行此命令来查看 ADDSDeployment 模块中的可用 cmdlet。

Get-Command -Module ADDSDeployment 

若要查看可为 cmdlet 指定的参数及其语法的列表,请执行下列操作:

Get-Help <cmdlet name> 

例如,若要查看用于创建未占用的只读域控制器 (RODC) 帐户的参数,请键入

Get-Help Add-ADDSReadOnlyDomainControllerAccount 

可选参数将显示在方括号中。

你可以针对远程服务器运行 Windows PowerShell cmdlet:

  • 在 Windows PowerShell 中,将 Invoke-Command 与 ADDSDeployment cmdlet 配合使用。 例如,若要在 contoso.com 域中名为 ConDC3 的远程服务器上安装 AD DS,请键入:

    Invoke-Command { Install-ADDSDomainController -DomainName contoso.com -Credential (Get-Credential) } -ComputerName ConDC3 

-或-

  • 在服务器管理器中,创建包括远程服务器的服务器组。 右键单击远程服务器的名称,再单击“Windows PowerShell”

以下几个部分将讲解如何运行 ADDSDeployment 模块 cmdlet 以安装 AD DS。

以下表格列出了 Windows PowerShell 中 ADDSDeployment cmdlet 的参数。 以粗体显示的参数为必填的。 如果在 Windows PowerShell 中命名方式不同,dcpromo.exe 的等效参数将列在括号中。

Windows PowerShell 开关接受 $TRUE 或 $FALSE 参数。 默认情况下不需要指定 $TRUE 参数。

若要覆盖默认值,可以使用 $False 值指定参数。 例如,由于未指定时将为新林安装自动运行 -InstallDNS,因此安装新林时阻止 DNS 安装的唯一方法是使用:

-InstallDNS:$False 

同样,由于在不托管 Windows Server DNS 服务器的环境中安装域控制器时 -InstallDNS 具有默认值 $False,因此需要指定以下参数才能安装 DNS 服务器:

-InstallDNS:$True 

-SafeModeAdministratorPassword 和 LocalAdministratorPassword 参数的操作特殊:

  • 如果未指定为参数,cmdlet 将提示你输入并确认掩蔽密码。 以交互方式运行 cmdlet 时,这是首选用法。

  • 如果指定值,则该值必须是安全字符串。 以交互方式运行 cmdlet 时,这不是首选用法。

例如,通过使用 Read-Host cmdlet 提示用户提供安全字符串,可手动提示输入密码。

-SafeModeAdministratorPassword (Read-Host -Prompt "DSRM Password:" -AsSecureString) 

你也可以提供安全字符串作为转换的明文变量,尽管强烈不建议这样做:

-SafeModeAdministratorPassword (ConvertTo-SecureString "Password1" -AsPlainText -Force) 

每个 ADDSDeployment cmdlet 都具有对应的测试 cmdlet。 测试 cmdlet 仅针对安装操作运行先决条件检查;不会配置任何安装设置。 每个测试 cmdlet 的参数都与对应安装 cmdlet 的相同,但 “SkipPreChecks 不可用于测试 cmdlet。

安装新林的命令语法如下。 可选参数将显示在方括号内。

Install-ADDSForest [-SkipPreChecks] -DomainName <string> -SafeModeAdministratorPassword <SecureString> [-CreateDNSDelegation] [-DatabasePath <string>] [-DNSDelegationCredential <PS Credential>] [-NoDNSOnNetwork] [-DomainMode <DomainMode> {Win2003 | Win2008 | Win2008R2 | Win2012}] [-DomainNetBIOSName <string>] [-ForestMode <ForestMode> {Win2003 | Win2008 | Win2008R2 | Win2012}] [-InstallDNS] [-LogPath <string>] [-NoRebootOnCompletion] [-SkipAutoConfigureDNS] [-SYSVOLPath] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>] 

例如,若要安装名为 corp.contoso.com 的新林并让系统安全提示提供 DSRM 密码,请键入:

Install-ADDSForest -DomainName "corp.contoso.com" 

若要安装名为 corp.contoso.com 的新林,在 contoso.com 域中创建 DNS 委派,将域功能级别设置为 Windows Server 2008 R2 并将林功能级别设置为 Windows Server 2008,在 D:\ 驱动器上安装 Active Directory 数据库和 SYSVOL,在 E:\ 驱动器上安装日志文件,以及让系统提示提供目录服务还原模式密码,请键入:

Install-ADDSForest -DomainName corp.contoso.com -CreateDNSDelegation -DomainMode Win2008 -ForestMode Win2008R2 -DatabasePath "d:\NTDS" -SYSVOLPath "d:\SYSVOL" -LogPath "e:\Logs" 

安装新域的命令语法如下。 可选参数将显示在方括号内。

Install-ADDSDomain [-SkipPreChecks] -NewDomainName <string> -ParentDomainName <string> -SafeModeAdministratorPassword <SecureString> [-ADPrepCredential <PS Credential>] [-AllowDomainReinstall] [-CreateDNSDelegation] [-Credential <PS Credential>] [-DatabasePath <string>] [-DNSDelegationCredential <PS Credential>] [-NoDNSOnNetwork] [-DomainMode <DomainMode> {Win2003 | Win2008 | Win2008R2 | Win2012}] [DomainType <DomainType> {Child Domain | TreeDomain} [-InstallDNS] [-LogPath <string>] [-NoGlobalCatalog] [-NewDomainNetBIOSName <string>] [-NoRebootOnCompletion] [-ReplicationSourceDC <string>] [-SiteName <string>] [-SkipAutoConfigureDNS] [-Systemkey <SecureString>] [-SYSVOLPath] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>] 

例如,若要使用 corp\EnterpriseAdmin1 的凭据创建名为 child.corp.contoso.com 的新子域,安装 DNS 服务器,在 corp.contoso.com 域中创建 DNS 委派,将域功能级别设置为 Windows Server 2003,将域控制器设为名为 Houston 的域中的全局目录服务器,将 DC1.corp.contoso.com 用作复制源域控制器,在 D:\ 驱动器上安装 Active Directory 数据库和 SYSVOL,在 E:\ 驱动器上安装日志文件,并让系统提示提供目录服务还原模式密码但不提示确认命令,请键入:

Install-ADDSDomain -SafeModeAdministratorPassword -Credential (get-credential corp\EnterpriseAdmin1) -NewDomainName child -ParentDomainName corp.contoso.com -InstallDNS -CreateDNSDelegation -DomainMode Win2003 -ReplicationSourceDC DC1.corp.contoso.com -SiteName Houston -DatabasePath "d:\NTDS" "SYSVOLPath "d:\SYSVOL" -LogPath "e:\Logs" -Confirm:$False 

安装其他域控制器的命令语法如下。 可选参数将显示在方括号内。

Install-ADDSDomainController -DomainName <string> [-SkipPreChecks] -SafeModeAdministratorPassword <SecureString> [-ADPrepCredential <PS Credential>] [-AllowDomainControllerReinstall] [-ApplicationPartitionsToReplicate <string[]>] [-CreateDNSDelegation] [-Credential <PS Credential>] [-CriticalReplicationOnly] [-DatabasePath <string>] [-DNSDelegationCredential <PS Credential>] [-NoDNSOnNetwork] [-NoGlobalCatalog] [-InstallationMediaPath <string>] [-InstallDNS] [-LogPath <string>] [-MoveInfrastructureOperationMasterRoleIfNecessary] [-NoRebootOnCompletion] [-ReplicationSourceDC <string>] [-SiteName <string>] [-SkipAutoConfigureDNS] [-SystemKey <SecureString>] [-SYSVOLPath <string>] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>] 

若要在 corp.contoso.com 域中安装域控制器和 DNS 服务器并让系统提示提供域管理员凭据和 DSRM 密码,请键入:

Install-ADDSDomainController -Credential (Get-Credential CORP\Administrator) -DomainName "corp.contoso.com" 

如果计算机已加入域且你是 Domain Admins 组的成员,则可以使用:

Install-ADDSDomainController -DomainName "corp.contoso.com" 

若要让系统提示提供域名,请键入:

Install-ADDSDomainController -Credential (Get-Credential) -DomainName (Read-Host "Domain to promote into") 

以下命令将使用 Contoso\EnterpriseAdmin1 的凭据在名为 Boston 的站点中安装可写域控制器和全局编录服务器,安装 DNS 服务器,在 contoso.com 域中创建 DNS 委派,从存储在 c:\ADDS IFM 文件夹中的媒体安装,在 D:\ 驱动器上安装 Active Directory 数据库和 SYSVOL,在 E:\ 驱动器上安装日志文件,让服务器在 AD DS 安装完成后自动重新启动,以及让系统提示提供目录服务还原模式密码:

Install-ADDSDomainController -Credential (Get-Credential CONTOSO\EnterpriseAdmin1) -CreateDNSDelegation -DomainName corp.contoso.com -SiteName Boston -InstallationMediaPath "c:\ADDS IFM" -DatabasePath "d:\NTDS" -SYSVOLPath "d:\SYSVOL" -LogPath "e:\Logs" 

创建 RODC 帐户的命令语法如下。 可选参数将显示在方括号内。

Add-ADDSReadOnlyDomainControllerAccount [-SkipPreChecks] -DomainControllerAccuntName <string> -DomainName <string> -SiteName <string> [-AllowPasswordReplicationAccountName <string []>] [-NoGlobalCatalog] [-Credential <PS Credential>] [-DelegatedAdministratorAccountName <string>] [-DenyPasswordReplicationAccountName <string []>] [-InstallDNS] [-ReplicationSourceDC <string>] [-Force] [-WhatIf] [-Confirm] [<Common Parameters>] 

将服务器连接到 RODC 帐户的命令语法如下。 可选参数将显示在方括号内。

Install-ADDSDomainController -DomainName <string> [-SkipPreChecks] -SafeModeAdministratorPassword <SecureString> [-ADPrepCredential <PS Credential>] [-ApplicationPartitionsToReplicate <string[]>] [-Credential <PS Credential>] [-CriticalReplicationOnly] [-DatabasePath <string>] [-NoDNSOnNetwork] [-InstallationMediaPath <string>] [-InstallDNS] [-LogPath <string>] [-MoveInfrastructureOperationMasterRoleIfNecessary] [-NoRebootOnCompletion] [-ReplicationSourceDC <string>] [-SkipAutoConfigureDNS] [-SystemKey <SecureString>] [-SYSVOLPath <string>] [-UseExistingAccount] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>] 

例如,若要创建名为 RODC1 的 RODC 帐户,请键入:

Add-ADDSReadOnlyDomainControllerAccount -DomainControllerAccountName RODC1 -DomainName corp.contoso.com -SiteName Boston DelegatedAdministratoraccountName AdminUser 

然后在要连接到 RODC1 帐户的服务器上运行以下命令。 服务器无法加入域。 首先,安装 AD DS 服务器角色和管理工具:

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

然后运行下列命令以创建 RODC:

Install-ADDSDomainController -DomainName corp.contoso.com -SafeModeAdministratorPassword (Read-Host -Prompt "DSRM Password:" -AsSecureString) -Credential (Get-Credential Corp\AdminUser) -UseExistingAccount 

按 Y 确认或包含 “confirm 参数阻止确认提示出现。

使用服务器管理器安装 AD DS

依次使用服务器管理器中的添加角色向导以及 Windows Server 2012 中新推出的 Active Directory 域服务配置向导,可在 Windows Server 2012 中安装 AD DS。 Active Directory 域服务安装向导 (dcpromo.exe) 从 Windows Server 2012 开始已弃用。

以下几个部分讲解如何创建服务器池以在多台服务器上安装和管理 AD DS,以及如何使用相应向导安装 AD DS。

只要可从运行服务器管理器的计算机访问,服务器管理器就将在网络上共用其他服务器。 共用后,可选择用于远程安装 AD DS 的服务器或服务器管理器内的任何其他可能配置选项。 运行服务器管理器的计算机将自动共用本身。 有关服务器池的详细信息,请参阅将服务器添加到服务器管理器

管理凭据

安装 AD DS 的凭据要求会因选择的部署配置而异。 有关详细信息,请参阅运行 Adprep.exe 和安装 Active Directory 域服务的凭据要求

采用以下过程来使用 GUI 方法安装 AD DS。 这些步骤可在本地或远程执行。 有关这些步骤的详细说明,请参阅以下主题:

使用图形用户界面执行 RODC 分步安装

RODC 分步安装允许你分两步创建 RODC。 在第一步中,Domain Admins 组成员将创建 RODC 帐户。 在第二步中,将服务器连接到 RODC 帐户。 第二步可由 Domain Admins 组成员或委派的域用户或组完成。

创建 RODC 帐户后,可以将服务器连接到帐户,以完成 RODC 安装。 第二步可在 RODC 所在的分支机构完成。 执行此过程的服务器必须未加入域。 从 Windows Server 2012 开始,使用服务器管理器中的添加角色向导将服务器连接到 RODC 帐户。

另请参阅

原文链接:https://learn.microsoft.com/zh-cn/windows-server/identity/ad-ds/deploy/install-active-directory-domain-services–level-100-

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享