共用方式為


降級域控制器和網域

本文說明如何使用 伺服器管理員 或 Windows PowerShell 移除 Active Directory 網域服務 (AD DS)。

AD DS 移除工作流程

下列工作流程圖表顯示移除 AD DS 的步驟。

AD DS 移除工作流程圖表

Caution

不支援在升級為域控制器 (DC) 後,使用 Dism.exe 或 Windows PowerShell DISM 模組移除 AD DS 角色,這樣會導致伺服器無法正常開機。

不同於伺服器管理員或 Windows PowerShell 的 ADDSDeployment 模組,DISM 是原生的服務系統,並未繼承 AD DS 的舊有知識或其組態。 除非伺服器不再是域控制器,否則不建議使用 Dism.exe 或 Windows PowerShell DISM 模組來卸載 AD DS 角色。

使用 PowerShell 降級和角色移除

ADDSDeployment 和 ServerManager Cmdlet Arguments (Bold arguments are required. Italicized arguments can be specified by using Windows PowerShell or the AD DS Configuration Wizard.)
Uninstall-ADDSDomainController -SkipPreChecks

-LocalAdministratorPassword

-Confirm

-Credential

-DemoteOperationMasterRole

-DNSDelegationRemovalCredential

-Force

-ForceRemoval

-IgnoreLastDCInDomainMismatch

-IgnoreLastDNSServerForZone

-LastDomainControllerInDomain

-Norebootoncompletion

-RemoveApplicationPartitions

-RemoveDNSDelegation

-RetainDCMetadata

Uninstall-WindowsFeature/Remove-WindowsFeature -Name

-IncludeManagementTools

-Restart

-Remove

-Force

-ComputerName

-Credential

-LogPath

-Vhd

To learn more about how to demote your DC using PowerShell, see the Uninstall-ADDSDomainController and Uninstall-WindowsFeature PowerShell references.

使用 Uninstall-ADDSDomainControllerUninstall-WindowsFeature時,這些命令只需要最小自變數,因為它們會執行單一動作。 Pressing the Enter key during the confirmation phase initiates the irrevocable demotion process and restarts your device.

The Credential argument is only required if you aren't already signed in as a member of the Enterprise Admins group or the Domain Admins group. The IncludeManagementTools argument is only required if you want to remove all of the AD DS management utilities.

Demote

移除角色和功能

有兩種方法可用來移除AD DS角色:

  • The Manage menu on the main dashboard, using Remove Roles and Features

    伺服器管理員 - 移除角色和功能

  • Select AD DS or All Servers on the navigation pane. 向下捲動到 [角色和功能] 區段。 以滑鼠右鍵按一下 [角色和功能] 清單中的 [Active Directory 網域服務],然後選取 [移除角色或功能]。 This interface skips the Server Selection page.

    伺服器管理員 - 所有伺服器- 移除角色和功能

The ServerManager cmdlets Uninstall-WindowsFeature and Remove-WindowsFeature prevent you from removing the AD DS role until you demote the domain controller.

Server selection

移除角色和功能精靈介面選擇目標伺服器

The Server Selection dialog enables you to choose from one of the servers previously added to the pool, as long as it's accessible. 執行伺服器管理員的本機伺服器始終自動處於可用狀態。

伺服器角色與功能

拿掉角色和功能精靈 - 選取要移除的角色

清除 [ Active Directory 網域服務 ] 複選框以降級域控制器; 如果伺服器目前是域控制器,則不會移除 AD DS 角色,而是切換至包含降級選項的 [ 驗證結果 ] 對話方塊。 否則,它會像其他任何角色功能一樣,移除可執行檔。

  • 如果您想要立即再次升級網域控制站,請勿移除任何其他的 AD DS 相關角色或功能 (例如 DNS、GPMC 或 RSAT 工具)。 拿掉其他角色和功能會增加重新發行的時間,因為當您重新安裝角色時,伺服器管理員會重新安裝這些功能。
  • 如果您想要永久降級網域控制站,請自行選擇移除不必要的 AD DS 角色與功能。 這需要取消勾選那些角色與功能的核取方塊。

AD DS 相關角色與功能的完整清單包括:

  • Windows PowerShell 的 Active Directory 模組功能
  • AD DS 與 AD LDS 工具功能
  • Active Directory 管理中心功能
  • AD DS 嵌入式管理單元及命令列工具功能
  • DNS Server
  • 群組原則管理主控台

相等的 ADDSDeployment 和 ServerManager Windows PowerShell Cmdlet 為:

Uninstall-ADDSDomainController
Uninstall-WindowsFeature

拿掉角色和功能精靈 - 確認對話框

刪除角色與功能嚮導 - 驗證

Credentials

Active Directory 網域服務 組態精靈 - 認證選取

You configure demotion options on the Credentials page. 提供執行下列清單降級所需的認證:

  • 降級額外的域控制器需要域管理員憑證。 選取 [強制移除此網域控制站] 會降級網域控制站,但不會從 Active Directory 移除網域控制站物件的中繼資料。

    Warning

    除非域控制器無法連絡其他域控制器,而且 無法合理解決 該網路問題,否則請勿選取此選項。 強制降級會在樹系的剩餘網域控制站上的 Active Directory 中留下孤立的中繼資料。 此外,該域控制器上所有未複製的變更,例如密碼或新的用戶帳戶,都會永遠遺失。 遺留的中繼資料是 Microsoft 客戶支援案件中,造成 AD DS、Exchange、SQL 及其他軟體問題的主要原因之一。

    If you forcibly demote a domain controller, you must manually perform metadata cleanup immediately. 如需相關步驟,請參閱清理伺服器中繼資料

    Active Directory 網域服務 組態精靈 - 認證強制移除

  • 將網域中最後一個網域控制站降格需要具備 Enterprise Admins 群組的成員資格,因為這將移除網域本身(如果這是樹系中最後一個網域,則將移除整個樹系)。 [伺服器管理員] 會通知您目前的網域控制站是否為此網域的最後一部網域控制站。 選取 [網域中最後一個網域控制站] 核取方塊來確認網域控制站是網域中的最後一個網域控制站。

對等的 ADDSDeployment Windows PowerShell 引數為:

-Credential <PSCredential>
-ForceRemoval <{ $true | $false }>
-LastDomainControllerInDomain <{ $true | $false }>

Warnings

Active Directory 網域服務 設定精靈 - 認證 FSMO 角色影響

The Warnings page alerts you to the possible consequences of removing this domain controller. 若要繼續,您必須選取 [繼續移除]

如果您先前在 [認證] 頁面上選取 [強制此網域控制站移除],[警告] 頁面就會顯示此網域控制站代管的所有彈性單一主機操作角色。 You must seize the roles from another domain controller immediately after demoting this server. 如需有關搶奪 FSMO 角色的詳細資訊,請參閱搶奪操作主機角色

此頁面沒有相等的 ADDSDeployment Windows PowerShell 引數。

Removal Options

Active Directory 網域服務 設定精靈 - 認證移除 DNS 和應用程式分割區

The Removal Options page appears, depending on previously selecting Last domain controller in the domain on the Credentials page. 此頁面可讓您設定額外的移除選項。 選取 忽略區域中最後一部 DNS 伺服器移除應用程式分割移除 DNS 委派 來啟用 下一步 按鈕。

選項只有在此網域控制站適用時才會顯示。 例如,如果沒有此伺服器的 DNS 委派,該複選框就不會顯示。

Select Change to specify alternate DNS administrative credentials. Select View Partitions to view extra partitions the wizard removes during the demotion. 根據預設,唯一的其他分割區是網域 DNS 和樹系 DNS 區域。 所有其他分割都是非 Windows 分割。

相等的 ADDSDeployment Cmdlet 引數為:

-IgnoreLastDnsServerForZone <{ $true | false }>
-RemoveApplicationPartitions <{ $true | false }>
-RemoveDNSDelegation <{ $true | false }>
-DNSDelegationRemovalCredential <PsCredential>

新增系統管理員密碼

Active Directory 網域服務 設定精靈 - 認證新系統管理員密碼

一旦降級完成且電腦成為網域成員伺服器或工作群組電腦之後,[新系統管理員密碼] 頁面會要求您為本機電腦內建的 Administrator 帳戶提供一個密碼。

The Uninstall-ADDSDomainController cmdlet and arguments follow the same defaults as Server Manager if not specified.

The LocalAdministratorPassword argument is special:

  • If not specified as an argument, then the cmdlet prompts you to enter and confirm a masked password. 這是以互動方式執行 Cmdlet 時的慣用用法。
  • 如果指定,則此值必須是安全字串。 這不是以互動方式執行 Cmdlet 時的首選用法。

For example, you can manually prompt for a password by using the Read-Host cmdlet to prompt the user for a secure string.

Uninstall-ADDSDomainController -LocalAdministratorPassword (Read-Host -Prompt "Password:" -AsSecureString)

由於前兩個選項未確認密碼,請特別注意並採取極度謹慎的措施。 看不到密碼。

您也可以提供轉換的純文字變數當做安全字串,不過我們不鼓勵這種做法。 For example:

Uninstall-ADDSDomainController -LocalAdministratorPassword (ConvertTo-SecureString "Password1" -AsPlainText -Force)

不建議提供或儲存純文本密碼。 執行此命令於指令碼中或有人從旁觀看,任何人都會知道該電腦的本機管理員密碼。 取得該資訊之後,他們就可以存取所有資料,而且可以模擬伺服器本身。

Confirmation

Active Directory 網域服務 設定精靈 - 檢閱選項

The Confirmation page shows the planned demotion; the page doesn't list demotion configuration options. 這是開始降級之前精靈所顯示的最後一頁。 [檢視指令碼] 按鈕會建立 Windows PowerShell 降級腳本。

Select Demote to run the following AD DS Deployment cmdlet:

Uninstall-ADDSDomainController

Use the optional Whatif argument with the Uninstall-ADDSDomainController and cmdlet to review configuration information. 這可讓您看到明確和隱含的 Cmdlet 引數值。

For example:

終端機視窗的螢幕快照,其中顯示 Cmdlet 自變數的明確和隱含值。

使用 ADDSDeployment Windows PowerShell 時,重新啟動提示是您取消此作業的最後機會。 To override that prompt, use the -force or confirm:$false arguments.

Demotion

Active Directory 網域服務 組態精靈 - 降級進行中

When the Demotion page displays, the domain controller configuration begins and can't be halted or canceled. 詳細的作業會在此頁面上顯示並寫入記錄檔:

  • %systemroot%\debug\dcpromo.log
  • %systemroot%\debug\dcpromoui.log

PowerShell Uninstall-ADDSDomainController 範例

PowerShell Uninstall-WindowsFeature 範例

To accept the reboot prompt automatically, use the -force or -confirm:$false arguments with any ADDSDeployment Windows PowerShell cmdlet. To prevent the server from automatically rebooting at the end of promotion, use the -norebootoncompletion:$false argument.

Warning

建議您不要覆寫重新開機設定。 成員伺服器必須重新開機才能正確運作。

PowerShell Uninstall-ADDSDomainController 強制範例

Here's an example of forcibly demoting with its minimal required arguments of -forceremoval and -demoteoperationmasterrole. The -credential argument isn't required because the user logged on as a member of the Enterprise Admins group:

終端機視窗的螢幕快照,其中顯示強制降級的範例,其基本必要自變數為 -forceremoval 和 -demoteoperationmasterrole。

Here's an example of removing the last domain controller in the domain with its minimal required arguments of -lastdomaincontrollerindomain and -removeapplicationpartitions:

PowerShell Uninstall-ADDSDomainController -LastDomainControllerInDomain 範例

如果您嘗試在降級伺服器之前移除 AD DS 角色,Windows PowerShell 會以錯誤來阻止您:

在移除 AD-Domain-Services 期間,卸載必要條件步驟失敗,無法繼續卸載。1.必須先降級域控制器,才能卸載 Active DirectoryDomain 服務角色。

Important

您必須在降級伺服器後重新啟動電腦,才能移除 AD 網域服務角色組件的二進位檔。

Results

拿掉 AD DS 之後,您即將註銷警告

The Results page shows the success or failure of the promotion and any important administrative information. 域控制器會在 10 秒後自動重新啟動。