- Active Directory Administration Cookbook
- Sander Berkouwer
- 96字
- 2021-06-24 14:42:13
Using the Active Directory module for Windows PowerShell
To graciously demote a domain controller, you can use the Uninstall-ADDSDomainController PowerShell cmdlet. The simplest script would look like that shown in the following example:
Import-Module ADDSDeployment
Uninstall-ADDSDomainController
This will remove the domain controller from the Active Directory domain and prompt you for the new password for the built-in administrator account after demotion. Replace the values in the previous sample file with the values of your choice.
To remove the Active Directory Domain Services role, use the following PowerShell line:
Uninstall-WindowsFeature AD-Domain-Services -IncludeManagementTools