共用方式為


DCPROMO 應答文件語法

本文介紹 dcpromo 應答文件用於在域控制器上安裝和刪除 Active Directory 域服務 (AD DS) 的參數和選項。 您可以使用此資訊生成應答檔,以便在域控制器上執行AD DS 的無人參與安裝。 還可以使用應答檔在無人參與模式下刪除 AD DS。

DCPROMO summary

Dcpromo.exe 是一個可用於提升和降級 Active Directory 域控制器的程式。 管理員可以使用 dcpromo 應答檔執行以下無人值守任務:

  • 將工作組和成員伺服器升級到 Active Directory 域控制器。
  • 將 Microsoft Windows NT 4.0 域控制器升級到 Active Directory 域控制器。
  • 降級域控制器。

Windows Server 2000 及更高版本支援 dcpromo 應答文件語法。 但是,雖然 Windows Server 2012 及更高版本仍支援 dcpromo 應答文件語法,但它們將 dcpromo.exe 替換為 PowerShell cmdlet。 有關詳細資訊,請參閱 Active Directory PowerShell 模組參考

Basic syntax

dcpromo 應答檔是一個 ASCII 文字檔,它為 Active Directory 域服務配置精靈的每一頁提供自動使用者輸入。

若要在自動模式下啟動 dcpromo ,請移至 [開始],輸入 dcpromo,然後在提升許可權的命令提示字元視窗中執行下列命令:

dcpromo /answer:<answer.txt>

Note

在此範例命令中, <answer.txt> 是您計劃用於降級或升級的應答文件的路徑和檔名的佔位元。

每個 dcpromo作都需要對應答檔的 [DCInstall] 部分中特定欄位的答案。 以下清單提供了每個作的必填欄位。 如果未指定選項,則使用預設值。 這些欄位的預設值在 欄位定義中說明。

  • 對於新的林安裝,以下選項適用:

    [DCINSTALL]
    InstallDNS=yes  
    NewDomain=forest  
    NewDomainDNSName=\<The fully qualified Domain Name System (DNS) name>  
    DomainNetBiosName=\<By default, the first label of the fully qualified DNS name>  
    SiteName=\<Default-First-Site-Name>  
    ReplicaOrNewDomain=domain  
    ForestLevel=\<The forest functional level number>  
    DomainLevel=\<The domain functional level number>  
    DatabasePath="\<The path of a folder on a local volume>"  
    LogPath="\<The path of a folder on a local volume>"  
    RebootOnCompletion=yes  
    SYSVOLPath="\<The path of a folder on a local volume>"  
    SafeModeAdminPassword=\<The password for an offline administrator account>  
    
  • 對於子域安裝,以下選項適用:

    [DCINSTALL]  
    ParentDomainDNSName=\<Fully qualified DNS name of parent domain>  
    UserName=\<The administrative account in the parent domain>  
    UserDomain=\<The name of the domain of the user account>  
    Password=\<The password for the user account> Specify * to prompt the user for credentials during the installation.  
    NewDomain=child  
    
    ChildName=\<The single-label DNS name of the new domain>  
    SiteName=\<The name of the AD DS site in which this domain controller will reside> This site must be created in advance in the Dssites.msc snap-in.  
    DomainNetBiosName=\<The first label of the fully qualified DNS name>  
    ReplicaOrNewDomain=domain  
    DomainLevel=\<The domain functional level number> This value can't be less than the current value of the forest functional level.  
    
    DatabasePath="\<The path of a folder on a local volume>"  
    LogPath="\<The path of a folder on a local volume>"  
    SYSVOLPath="\<The path of a folder on a local volume>"  
    InstallDNS=yes  
    
    CreateDNSDelegation=yes  
    DNSDelegationUserName= \<The account that has permissions to create a DNS delegation> The account that is being used to install AD DS may differ from the account in the parent domain that has the permissions that are required to create a DNS delegation. In this case, specify the account that can create the DNS delegation for this parameter. Specify \* to prompt the user for credentials during the installation.  
    DNSDelegationPassword= \<The password for the account that is specified for DNSDelegationUserName> Specify * to prompt the user for a password during the installation.  
    SafeModeAdminPassword=\<The password for an offline administrator account>  
    RebootOnCompletion=yes 
    
  • 對於現有林安裝中的新樹,以下選項適用:

    [DCINSTALL]  
    UserName=\<An administrative account in the parent domain>  
    UserDomain=\<The name of the domain of the user account>  
    Password=\<The password for the adminstrative account> Specify \* to prompt the user for credentials during the installation.  
    NewDomain=tree  
    NewDomainDNSName=\<The fully qualified DNS name of the new domain>  
    SiteName=\<The name of the AD DS site in which this domain controller will reside> This site must be created in advance in the Dssites.msc snap-in.  
    DomainNetBiosName=\<The first label of the fully qualified DNS name>  
    ReplicaOrNewDomain=domain  
    DomainLevel=\<The domain functional level number>  
    DatabasePath="\<The path of a folder on a local volume>"  
    LogPath="\<The path of a folder on a local volume>"  
    SYSVOLPath="\<The path of a folder on a local volume>"  
    InstallDNS=yes  
    CreateDNSDelegation=yes  
    DNSDelegationUserName= \<The account that has permissions to create a DNS delegation> The account that is being used to install AD DS may differ from the account in the parent domain that has the permissions that are required to create a DNS delegation. In this case, specify the account that can create the DNS delegation for this parameter. Specify \* to prompt the user for credentials during the installation.  
    DNSDelegationPassword=\<The password for the account that is specified for DNSDelegationUserName> Specify * to prompt the user for a password during the installation.  
    SafeModeAdminPassword=\<The password for an offline administrator account>  
    RebootOnCompletion=yes  
    
  • 對於其他域控制器安裝,以下選項適用:

    [DCINSTALL]  
    UserName=\<The administrative account in the domain of the new domain controller>  
    UserDomain=\<The name of the domain of the new domain controller>  
    Password=\<The password for the UserName account>  
    SiteName=\<The name of the AD DS site in which this domain controller will reside> This site must be created in advance in the Dssites.msc snap-in.  
    ReplicaOrNewDomain=replica  
    ReplicaDomainDNSName=\<The fully qualified domain name (FQDN) of the domain in which you want to add an additional domain controller>  
    DatabasePath="\<The path of a folder on a local volume>"  
    LogPath="\<The path of a folder on a local volume>"  
    SYSVOLPath="\<The path of a folder on a local volume>"  
    InstallDNS=yes  
    ConfirmGC=yes  
    SafeModeAdminPassword=\<The password for an offline administrator account>  
    RebootOnCompletion=yes  
    
  • 對於使用從介質安裝 (IFM) 方法的其他域控制器安裝,以下選項適用:

    [DCINSTALL]  
    UserName=\<The administrative account in the domain of the new domain controller>  
    Password=\<The password for the UserName account>  
    UserDomain=\<The name of the domain of the UserName account>  
    DatabasePath="\<The path of a folder on a local volume>"  
    LogPath="\<The path of a folder on a local volume>"  
    SYSVOLPath="\<The path of a folder on a local volume>"  
    SafeModeAdminPassword=\<The password of an offline administrator account>  
    
    CriticalReplicationOnly=no  
    SiteName=\<The name of the AD DS site in which this domain controller will reside>  
    This site must be created in advance in the Dssites.msc snap-in.  
    
    ReplicaOrNewDomain=replica  
    ReplicaDomainDNSName=\<The fully qualified domain name (FQDN) of the domain in which you want to add an additional domain controller>  
    ReplicationSourceDC=\<An existing domain controller in the domain>  
    
    ReplicationSourcePath=\<The local drive and the path of the backup>  
    
    RebootOnCompletion=yes 
    
  • 對於唯讀域控制器 (RODC) 安裝,以下選項適用:

    [DCINSTALL]  
    UserName=\<The administrative account in the domain of the new domain controller>  
    UserDomain=\<The name of the domain of the user account>  
    PasswordReplicationDenied=\<The names of the user, group, and computer accounts whose passwords are not to be replicated to this RODC>  
    PasswordReplicationAllowed =\<The names of the user, group, and computer accounts whose passwords can be replicated to this RODC>  
    DelegatedAdmin=\<The user or group account name that will install and administer the RODC>  
    SiteName=Default-First-Site-Name  
    CreateDNSDelegation=no  
    CriticalReplicationOnly=yes  
    
    Password=\<The password for the UserName account>  
    ReplicaOrNewDomain=ReadOnlyReplica  
    ReplicaDomainDNSName=\<The FQDN of the domain in which you want to add an additional domain controller>  
    DatabasePath= "\<The path of a folder on a local volume>"  
    LogPath="\<The path of a folder on a local volume>"  
    SYSVOLPath="\<The path of a folder on a local volume>"  
    InstallDNS=yes  
    ConfirmGC=yes  
    SafeModeAdminPassword=\<The password for an offline administrator account>  
    RebootOnCompletion=yes  
    
  • 對於刪除 AD DS,以下選項適用:

    [DCINSTALL]  
    UserName=\<An administrative account in the domain>  
    UserDomain=\<The domain name of the administrative account>  
    Password=\<The password for the UserName account>  
    AdministratorPassword=\<The local administrator password for the server>  
    RemoveApplicationPartitions=yes  
    RemoveDNSDelegation=yes  
    DNSDelegationUserName=\<The DNS server administrative account for the DNS zone that contains the DNS delegation>  
    DNSDelegationPassword=\<The password for the DNSDelegationUserName account>  
    RebootOnCompletion=yes  
    
  • 要從域中的最後一個域控制器中刪除 AD DS,以下選項適用:

    [DCINSTALL]  
    UserName=\<An administrative account in the parent domain>  
    UserDomain=\<The domain name of the UserName account>  
    Password=\<The password for the UserName account> Specify * to prompt the user for credentials during the installation.  
    IsLastDCInDomain=yes  
    AdministratorPassword=\<The local administrator password for the server>  
    RemoveApplicationPartitions=If you want to remove the partitions, specify "yes" (no quotation marks) for this entry. If you want to keep the partitions, this entry is optional.  
    RemoveDNSDelegation=yes  
    DNSDelegationUserName=\<The DNS server administrative account for the DNS zone that contains the DNS delegation>  
    DNSDelegationPassword=\<The password for the DNS server administrative account>  
    RebootOnCompletion=yes  
    
  • 要刪除林中的最後一個域控制器,以下選項適用:

    [DCINSTALL]  
    UserName=\<An administrative account in the parent domain>  
    UserDomain=\<The domain name of the UserName account>  
    Password=\<The password for the UserName account> Specify * to prompt the user for credentials during the installation.  
    IsLastDCInDomain=yes  
    AdministratorPassword=\<The local administrator password for the server>  
    RemoveApplicationPartitions=If you want to remove the partitions, specify "yes" (no quotation marks) for this entry. If you want to keep the partitions, this entry is optional.  
    RemoveDNSDelegation=yes  
    DNSDelegationUserName=\<The DNS server administrative account for the DNS zone that contains the DNS delegation>  
    DNSDelegationPassword=\<The password for the DNS server administrative account>  
    RebootOnCompletion=yes  
    

Field definitions

本節介紹可在應答檔中使用的欄位和條目。

安裝運行參數

Parameter Default value Description
AllowDomainReinstall 是 | 否 此條目指定現有域是否為重新創建的域。
AllowDomainControllerReinstall 是 | 否 此條目指定是否繼續安裝此域控制器,即使服務檢測到使用相同名稱的活動域控制器帳戶。 只有在您確定現有帳戶不再作用中時,才指定 [是 ]。
ApplicationPartitionsToReplicate No default 此條目指定必須以 格式 "partition1 partition2"複製的應用程式分區。 如果指定 *,則服務將複製所有應用程式分區。 使用空格分隔或逗號和空格分隔的專有名稱。 將整個字串括在引號中。
ChildName No default 這是附加到 ParentDomainDNSName 條目的從屬域的名稱。 如果父域為 A.COM 且從屬域為 B,請輸入 B.A.COM and B ChildName。
ConfirmGc 是 | 否 此項目指定副本是否也是全域目錄。 Yes (是) 如果備份是全域編錄,則使副本成為全域編錄。 否 不會使副本成為全域目錄。 這些條目不需要引號。
CreateDNSDelegation 是 |否,無預設值 此條目指示是否創建引用此新 DNS 伺服器的 DNS 委託。 此條目僅對 AD DS 集成的 DNS 有效。
CriticalReplicationOnly 是 | 否 此條目指定安裝作在重新啟動之前是否僅執行重要複製,然後跳過複製的非關鍵部分以節省時間。 非關鍵複製在角色安裝完成後進行,並且計算機重新啟動。
DatabasePath %systemroot%\\NTDS 此條目是本地電腦硬碟上完全限定的非通用命名約定 (UNC) 目錄的路徑。 此目錄託管 AD DS 資料庫 (NTDS.DIT) 的 如果目錄存在,它必須是空的。 如果不存在,則此條目將創建它。 您選擇用於儲存目錄的邏輯驅動器上的可用磁碟空間必須為 200 MB。 為了容納捨入錯誤或域中的所有物件,可用磁碟空間可能必須更大。 為了獲得最佳性能,請在專用硬碟上找到該目錄。
DelegatedAdmin No default 此條目指定安裝和管理 RODC 的使用者或組的名稱。 如果沒有指定的值,則只有 Domain Admins 組或 Enterprise Admins 組的成員才能安裝和管理 RODC。
DNSDelegationPassword <密碼> | *,無預設值 此條目指定用於創建或刪除 DNS 委派的使用者帳戶的密碼。 指定 * 以提示使用者輸入認證。
DNSDelegationUserName No default 此項目指定服務在建立或刪除 DNS 委託時使用的使用者名。 如果您未指定值,則服務將使用您為安裝或刪除 DNS 委派的 AD DS 指定的帳戶憑據。
DNSOnNetwork 是 | 否 此條目指定 DNS 服務在網路上是否可用。 僅當此計算機的網路適配器未配置為使用 DNS 伺服器的名稱進行名稱解析時,該服務才使用此條目。 指定 No 以指示此電腦上安裝了 DNS 以進行名稱解析。 否則,必須將網路適配器配置為首先使用 DNS 伺服器名稱。
DomainLevel 0 |2 |3 |4 |5 |6 |7 |10、無預設 此專案會指定網域功能等級。 此專案是以在現有樹系中建立新網域時存在於樹系中的層級為基礎。 值描述如下:
- 0 = Windows 2000 Server 原生模式
- 2 = Windows Server 2003
- 3 = Windows Server 2008
- 4 = Windows Server 2008 R2
- 5 = Windows Server 2012
- 6 = Windows Server 2012 R2
- 7 = Windows Server 2016
- 10 = Windows Server 2025
DomainNetbiosName No default 此條目是 AD DS 之前的用戶端用於存取域的 NetBIOS 名稱。 DomainNetbiosName 在網路上必須是唯一的。
ForestLevel 0 |2 |3 |4 |5 |6 |7 |10 此條目指定在新林中創建新域時的林功能級別,如下所示:
- 0 = Windows 2000 Server 本機模式
- 2 = Windows Server 2003
- 3 = Windows Server 2008
- 4 = Windows Server 2008 R2
- 5 = Windows Server 2012
- 6 = Windows Server 2012 R2
- 7 = Windows Server 2016
- 10 = Windows Server 2025
在現有林中安裝新域控制器時,不得使用此條目。 ForestLevel 條目替換了 Windows Server 2003 中提供的 SetForestVersion 條目。
InstallDNS 是 |否,預設值會根據作業1 而變更。 此條目指定在 Active Directory 域服務安裝嚮導檢測到 DNS 動態更新協定不可用時,服務是否為新域配置 DNS。 如果嚮導檢測到現有域的 DNS 伺服器數量不足,則此條目也適用。
LogPath %systemroot%\\NTDS 這是承載 AD DS 紀錄檔的本地電腦上硬碟上的完全限定的非 UNC 目錄的路徑。 如果目錄存在,它必須是空的。 如果它不存在,則服務將創建它。
NewDomain 樹 |兒童 |森林 Tree 表示新域是現有林中新樹的根。 Child 表示新域是現有域的子域。 Forest 表示新域是域樹的新林中的第一個域。
NewDomainDNSName No default 此條目用於「現有林中的新樹」或「新林」安裝。 該值是未使用的 DNS 域。
ParentDomainDNSName No default 此條目指定子域安裝的現有父 DNS 域的名稱。
Password <密碼> | *,無預設值 此條目指定與配置域控制器的用戶帳戶相對應的密碼。 指定 * 以提示使用者輸入認證。 為了保護,安裝後將從應答檔中刪除密碼。 每次使用者使用應答檔時,都必須重新定義密碼。
PasswordReplicationAllowed < > Security_Principal |NONE,無預設值 此條目指定其密碼可複製到此 RODC 的電腦帳戶和使用者帳戶的名稱。 如果要將值留空,請指定 NONE。 默認情況下,此 RODC 上不會緩存任何使用者憑據。 要指定多個安全主體,請多次添加該條目。
PasswordReplicationDenied < > Security_Principal |沒有 此條目指定其密碼不會複製到 RODC 的使用者、組和電腦帳戶的名稱。 如果您不想拒絕複製任何使用者或計算機的憑證,請指定NONE。 要指定多個安全主體,請多次添加該條目。
RebootOnCompletion 是 | 否 此條目指定在安裝或刪除AD DS後是否重新啟動電腦,而不管作是否成功。
RebootOnSuccess 是 |否 |NoAndNoPrompt要麼 此項目指定在成功安裝或刪除AD DS 後是否必須重新啟動電腦。 始終需要重啟才能完成 AD DS 角色的更改。
ReplicaDomainDNSName No default 此條目指定要在其中配置其他域控制器的域的 FQDN。
ReplicaOrNewDomain 副本 |只讀副本 |域 此條目僅用於新安裝。 Domain 將伺服器轉換為新域的第一個域控制器。 ReadOnlyReplica 將伺服器轉換為 RODC。 Replica 將伺服器轉換為其他域控制器。
ReplicationSourceDC No default 此條目指定從中複製AD DS資料以創建新域控制器的合作夥伴域控制器的 FQDN。
ReplicationSourcePath No default 此條目指定用於創建新域控制器的安裝檔的位置。
SafeModeAdminPassword <密碼> |NONE,無預設值 此條目提供用於目錄服務還原模式的離線管理員帳戶的密碼。 您不能指定空密碼。
SiteName Default-First-Site-Name 此條目指定安裝新林時的網站名稱。 對於新林,預設值為 Default-First-Site-Name. 對於所有其他方案,服務使用當前網站和林的子網配置選擇網站。
SkipAutoConfigDNS No default 此條目適用於希望跳過用戶端設置、轉發器和根提示的自動配置的專家使用者。 僅當伺服器上已安裝 DNS 伺服器服務時,該條目才有效。 在這種情況下,您會收到一條通知,確認服務跳過了 DNS 的自動配置。 否則,服務將忽略此條目。 如果指定此開關,請確保在安裝 AD DS 之前正確創建和配置區域,否則域控制器將無法按預期運行。 此條目不會跳過在父 DNS 區域中自動創建 DNS 委託。 要控制 DNS 委託創建,請使用 DNSDelegation 條目。
Syskey < > system_key |沒有 此項目指定從中複製資料的媒體的系統金鑰。
SYSVOLPath %systemroot%\\SYSVOL 此條目指定本地電腦硬碟上的完全限定的非 UNC 目錄。 此目錄將託管 AD DS 紀錄檔。 如果該目錄已存在,則它必須為空。 如果尚不存在,則由服務創建它。 該目錄必須位於使用NTFS 5.0檔案系統格式化的分區上。 為了獲得最佳性能,請將目錄放在與作系統不同的物理硬碟上。
TransferIMRoleIfNeeded 是 | 否 此條目指定是否將基礎結構主機角色轉移到此域控制器。 如果域控制器當前託管在全域編錄伺服器上,並且您不打算將域控制器設為全域編錄伺服器,則此條目非常有用。 指定 Yes (是) 將基礎設施主機角色轉移到此域控制器。 如果指定 Yes,請確保同時指定 ConfirmGC=No 條目。
UserDomain No default 此項目指定您計劃用於在伺服器上安裝 AD DS 的使用者帳戶的功能變數名稱。
UserName No default 此條目指定用於在伺服器上安裝 AD DS 的用戶帳戶名。 我們建議您以 format \<domain>\\<user_name> 指定帳戶憑證。

Note

1 針對新的樹系,預設會安裝 DNS 伺服器角色。 對於新樹、新子域或副本,如果 Active Directory 域服務安裝嚮導檢測到現有 DNS 基礎結構,則預設安裝 DNS 伺服器。 如果嚮導未檢測到現有 DNS 基礎設施,則預設情況下不會安裝 DNS 伺服器。

拿掉作參數

Parameter Default value Description
AdministratorPassword No default 此項目用於指定從域控制器中刪除 AD DS 時的本地管理員密碼。
DemoteFSMO 是 | 否 此條目指示即使域控制器擁有作主機角色,是否也會發生強制刪除。
DNSDelegationPassword <密碼> | *,無預設值 此項目指定您計劃用於建立或刪除 DNS 委託的使用者帳戶的密碼。 指定 * 以提示使用者輸入認證。
DNSDelegationUserName No default 此項目指定您計畫在建立或刪除 DNS 委派時使用的使用者名。 如果未指定值,則服務將使用您為 AD DS 安裝或 DNS 委派的 AD DS 刪除指定的帳戶憑據。
IgnoreIsLastDcInDomainMismatch 是 | 否 此條目指定當您指定IsLastDCInDomain=Yes條目或 Active Directory 域服務安裝嚮導檢測到域中有另一個活動域控制器時,是否繼續從域控制器中刪除 AD DS。 此條目也適用於您指定IsLastDCInDomain=No條目且嚮導無法聯繫域中任何其他域控制器的方案。
IgnoreIsLastDNSServerForZone 是 | 否 此條目指定是否繼續刪除AD DS,即使域控制器是域控制器託管的一個或多個AD DS集成 DNS 區域的最後一個 DNS 伺服器。
IsLastDCInDomain 是 | 否 此條目指定從中刪除AD DS的域控制器是否是域中的最後一個域控制器。
Password <密碼> | *,無預設值 此條目指定與您計劃用於配置域控制器的用戶帳戶相對應的密碼。 指定 * 以提示使用者輸入認證。 為了保護,該服務會在您安裝AD DS後從應答檔中刪除密碼。 每次有人使用應答檔時,都必須重新定義密碼。
RebootOnCompletion 是 | 否 此條目指定在安裝或刪除AD DS後是否重新啟動電腦,而不管作是否成功。
RebootOnSuccess 是 |否 |NoAndNoPrompt要麼 確定使用者在成功安裝或刪除AD DS後是否必須重新啟動電腦。 始終需要重啟才能完成 AD DS 角色的更改。
RemoveApplicationPartitions 是 | 否 此項目指定在從域控制器中刪除 AD DS 時是否刪除應用程式分區。 指定 Yes 將刪除域控制器上的應用程式分區。 指定 No 不會刪除域控制器上的應用程式分區。 如果域控制器託管任何應用程式目錄分區的最後一個副本,則必須手動確認需要刪除這些分區。
RemoveDNSDelegation 是 | 否 此項目指定是否從父 DNS 區域中刪除指向此 DNS 伺服器的 DNS 委託。
RetainDCMetadata 是 | 否 此條目指定在刪除 AD DS 後是否在域中保留域控制器元數據,以便委派管理員可以從 RODC 中刪除 AD DS。
UserDomain No default 此項目指定您計劃用於安裝 AD DS 的使用者帳戶的功能變數名稱。
UserName No default 此項目指定您計劃用於在伺服器上安裝 AD DS 的使用者帳戶名。 我們建議您以 format \<domain>\\<user_name> 指定帳戶憑證。

無人值守安裝返回代碼

完成基於 Windows Server 2008 的域控制器的無人值守安裝後,Active Directory 域服務安裝嚮導將返回成功或失敗代碼。 有關無人值守安裝返回代碼的更多資訊,請參閱 無人值守安裝返回代碼