Today we will look at how to Decommission (Uninstall) a Windows 2008 R2 Domain Controller.
Before Removing a domain controller we need to check the some important thing:
- Have another Global Catalog server
- FSMO Roles moved to another Domain Controller
- Domain Controller is Bridgehead server or not(If you have multiple sites)?
- Checks your DC to make sure it is healthy
- You must be a member of the Domain Admins group in the domain.
If you check all that we can perform this procedure:
- Click Start, click Run, type dcpromo, and then press ENTER.
2. On the Welcome to the Active Directory Domain Services Installation Wizard page, click Next:
3. If the domain controller is a global catalog server, a message appears to warn you about the effect of removing a global catalog server from the environment. Click OK to continue.
4. On the Delete the Domain page, make no selection, and then click Next:
5. On the Administrator Password page, type and confirm a secure password for the local Administrator account, and then click Next:
6. On the Summary page, if you want to save the settings that you selected to an answer file that you can use to automate subsequent operations in Active Directory Domain Services (AD DS), click Export settings. Type a name for your answer file, and then click Save.
if not Review your selections, and then click Next to remove AD DS.
7. On the Completing the Active Directory Domain Services Installation Wizard page, click Finish.
8. Restart the server to complete the AD DS removal when you are prompted:
9. After reboot , Open Server Manager. Click Start, point to Administrative Tools, and then click Server Manager and In Roles, click Remove Roles:
10. If necessary, review the information on the Before You Begin page, and then click Next:
11. On the Remove Server Roles page, clear the Active Directory Domain Services and DNS Server check box, and then click Next:
12. On the Confirm Removal Selections page, click Remove:
13. On the Removal Results page, click Close:
and then click Yes to restart the server
14. When you log in to server you can see this screen below, click Close:
15. After Removing DC remove the server from Active Directory Sites and Services:
That’s all to do Removing a Domain Controller from a Domain on Windows server 2008 r2.
В этой статье мы рассмотрим процедуры корректного удаления контроллера домена Active Directory на Windows Server 2022/2019/2016/2012R2. Обычно при удалении контроллера домена рассматривается один из сценариев:
Содержание:
- Понижение контроллера домена с удалением роли Active Directory Domain Services
- Удаление неисправного контроллера домена Active Directory
Понижение контроллера домена с удалением роли Active Directory Domain Services
Если вы выполняете плановое удаление (декомиссию) одного из существующих контроллеров домена AD (обычного DC или RODC), то прежде чем понизить контроллер домена до рядового Windows Server и удалить роль ADDS, нужно выполнить ряд подготовительных шагов.
- Проверьте состояние вашего контроллера домена, Active Directory и репликации. На сайте есть отдельная статья с описанием команд диагностики здоровья контроллера домена и репликации в AD с помощью
dcdiag
,
repadmin
и скриптов PowerShell. Исправьте найденные проблемы. Для вывода списка ошибок на конкретном контроллере домена выполните команду:
dcdiag.exe /s:dc01 /q
- Убедитесь, что на контроллере домена не запущены FSMO роли AD:
netdom query fsmo
Если нужно, перенесите роли FSMO на другой DC; - Убедитесь, что на DC не запушена роль DHCP сервера. Если запущена, мигрируйте ее на другой сервер;
- Измените настройки DNS для DHCP областей, которые выдаются клиентам IP адреса. Перенастройте DHCP клиентов на другой DNS сервер (дождитесь окончания времени аренды IP адресов, чтобы все клиенты получили новые настройки DNS). Вы можете вывести список DNS серверов, заданных для всех зон (DNS Servers Option 006) на определенном сервере с помощью следующей команды PowerShell (подробнее об управлении DHCP в Windows Server с помощью PowerShell):
Get-DhcpServerv4Scope -ComputerName msk-dhcp01.winitpro.ru| Get-DhcpServerv4OptionValue | Where-Object {$_.OptionID -like 6} | FT Value
- Некоторые клиенты могут быть настроены на использование DNS сервера на DC вручную (сетевые устройства, сервера, принтеры, сканеры и т.д.). Вам нужно найти такие устройства и перенастроить их на другой DNS сервер. Проще всего обнаружить устройства, обращающиеся к DNS серверу по его логам. Вот подробная статья: Аудит DNS запросов клиентов в Windows Server по DNS логам;
- Если на контроллере домена запущен центр сертификации (роль Certificate Authority), нужно мигрировать его на другой сервер;
- Если на контроллере домена запущены другие службы (например, KMS сервер, Raduis/NPS, WSUS и т.д.), решите нужно ли переносить их на другие сервера;
- Воспользуйтесь командлетом
Test-ADDSDomainControllerUninstallation
, чтобы проверить оставшиеся зависимости и проблемы, с которыми вы можете столкнуться при удалении DC. Если командлет вернет статус
Sucсess
, можете продолжить.
Теперь можно приступить к понижению роли контроллера домена до рядового сервера. До Windows Server 2012 для этого использовалась команда dcpromo. В современных версиях Windows Server этот инструмент считается устаревшим и не рекомендуется к использованию.
Вы можете понизить роль контроллера домена с помощью Server Manager. Запустите Server Manager -> Remote Roles and Features -> снимите чекбокс Active Directory Domain Services в секции Server Roles.
Нажмите на кнопку Demote this domain controller.
Должно открыться окно Active Directory Domain Services Configuration Wizard. Опцию Force the removal of this domain controller используется при удалении последнего контроллера домена. Включать ее не нужно. В дальнейшем мы удалим метаданные о DC вручную.
В следующем окне отметьте опцию Proceed with removal.
Затем задайте пароль учетной записи локального администратора сервера.
На последнем этапе останется нажать кнопку Demote.
Дождитесь окончания понижения контроллера домена. Должна появится надпись Successfully demoted the Active Directory Domain Controller.
Перезагрузите сервер, еще раз запустите Server Manager для удаления роли Active Directory Domain Services.
При удалении роли ADDS по-умолчанию будут удалены следующие компоненты:
- Модуль Active Directory Module for Windows PowerShell
- AD DS and AD LDS Tools feature
- Active Directory Administrative Center
- AD DS Snap-ins and Command-line Tools
- DNS Server
- Консоль Group Policy Management Console (
gpmc.msc
)
Запустите консоль Active Directory Users and Computers (dsa.msc) и убедитесь, что учетная запись контроллера домена была удалена из OU Domain Controllers.
Также вы можете удалить контроллер домена с помощью PowerShell командлета
Uninstall-ADDSDomainController
. Команда попросит вас задать пароль локального администратора и подтвердить понижение DC.
После перезагрузки останется с помощью PowerShell удалить роль ADDS:
Uninstall-WindowsFeature AD-Domain-Services -IncludeManagementTools
Теперь запустите консоль Active Directory Sites and Services (
dssite.msс
), найдите сайт контроллера домена и его учетную запись в разделе Servers. Разверните DC, щелкните ПКМ по NTDS Settings и выберите Delete.
Подтвердите удаление DC, отметив опцию Delete This Domain controller anyway. It is permanently offline and ac no longer be removed using the removal wizard.
Затем удалите учетную запись сервера.
Дождитесь окончания репликации в AD и проверьте состояние домена с помощью
dcdiag
и
repadmin
(как описано выше).
Удаление неисправного контроллера домена Active Directory
Если ваш контроллер домена вышел из строя (физический сервер или файлы виртуального DC на хранилище) и вы не планируете восстанавливать DC его из созданной ранее резервной копии контроллера домена, можно удалить его принудительно.
Важно. Удаленный таким образом контроллер домена ни в коем случае нельзя включать в сеть.
До Windows Server 2008 R2 для удаления неисправного контроллера домена и очистки его метаданных в AD использовалась консольная утилита ntdsutil. В современных версиях Windows Server 2022/2019/2016/2012 вы можете удалить вышедший из строя DC и корректно очистить метаданные с помощью графических
mmc
оснасток управления AD.
Откройте консоль ADUC (
dsa.msc
) и перейдите в контейнер Domain Controllers. Найдите учетную запись вашего DC и удалите ее.
Появится окно с подтверждением удаления DC. Включите опцию Delete this Domain Controller anyway. И нажмите кнопку Delete.
Active Directory автоматически очистит метаданные об удаленном DC из базы ntds.dit.
Теперь нужно удалить контроллер домена в консоли AD Sites and Services как описано выше.
И последний шаг – удаление записей о контроллере домена в DNS. Откройте консоль DNS Manager (
dnsmgmt.msc
).
Удалите сервер из списка Name Servers в настройках зоны.
Удалите статические записи Name Servers (NS), оставшиеся от удаленного DC в вашей DNS зоне и разделах
_msdcs
,
_sites
,
_tcp
,
_udp
, и PTR записи в обратной зоне.
Или воспользуйтесь PowerShell для поиска и удаления записей в DNS.
Итак, в этой статье мы описали пошаговую процедуру, которая поможет вам понизить контроллер домена или удалить неисправный DC из Active Directory.
Прочитано: 8 435
Исходная система: dc1.polygon.local – первый домен контроллер.
Dc2.polygon.local – не исправный домен контроллер.
Учётная запись ekzorchik обладающая правами «Domain Admins» (Администратор домена).
Предположим у нас поломался, сервер, на котором поднят dc2 – второй домен контроллер. Причин может быть масса: посыпались диски, неисправное железо, затопило серверную.
Заходим на dc1 из-под учетной записи ekzorchik. Открываем командную строку с правами Администратора и набираем:
NTDSUTIL – это утилита командной строки, которая предназначена для выполнения различных сложных операций с Active Directory, в том числе процедур обслуживания, управления и модификации Active Directory.
Ntdsutil для перехода в контекст:
C:\Users\ekzorchik>ntdsutil
ntdsutil: metadata cleanup
metadata cleanup: connections
Подключаемся к работоспособному домен контроллеру:
server connections: connect to server dc1
Binding to dc1 …
Connected to dc1 using credentials of locally logged on user.
server connections: quit
metadata cleanup: select operation target
select operation target: list sites
Found 1 site(s)
0 – CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=polygon,DC=local
select operation target: select site 0
Site – CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=polygon,DC=local
No current domain
No current server
No current Naming Context
, где <0> – где – номер сайта, в котором находился неисправный контроллер домена (команда list sites отобразит номер сайта)
select operation target: list servers in site
Found 2 server(s)
0 – CN=DC1,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=polygon,DC=local
1 – CN=DC2,CN=Servers,CN=Default-First-SiteName,CN=Sites,CN=Configuration,DC=polygon,DC=local
Выбираем неисправный:
select operation target: select server 1
Site – CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=polygon,DC=local
No current domain
Server – CN=DC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,
DC=polygon,DC=local
DSA object – CN=NTDS Settings,CN=DC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=polygon,DC=local
DNS host name – DC2.polygon.local
Computer object – CN=DC2,OU=Domain Controllers,DC=polygon,DC=local
No current Naming Context
select operation target: list domains
Found 1 domain(s)
0 – DC=polygon,DC=local
select operation target: select domain 0
Site – CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=polygon,DC=local
Domain – DC=polygon,DC=local
Server – CN=DC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,
DC=polygon,DC=local
DSA object – CN=NTDS Settings,CN=DC2,CN=Servers,CN=Default-First-Site-Na
me,CN=Sites,CN=Configuration,DC=polygon,DC=local
DNS host name – DC2.polygon.local
Computer object – CN=DC2,OU=Domain Controllers,DC=polygon,DC=local
No current Naming Context
select operation target: quit
metadata cleanup: remove selected server
Transferring / Seizing FSMO roles off the selected server.
Removing FRS metadata for the selected server.
Searching for FRS members under “CN=DC2,OU=Domain Controllers,DC=polygon,DC=local”.
Deleting subtree under “CN=DC2,OU=Domain Controllers,DC=polygon,DC=local”.
The attempt to remove the FRS settings on CN=DC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=polygon,DC=local failed because “Element not
found.”;
metadata cleanup is continuing.
“CN=DC2,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=polygon,DC=local” removed from server “dc1”
Открываем оснастку Active Directory Sites and Services:
«Start» – «Control Panel» – «Administrative Tools» – «Active Directory Sites and Services».
Выбираем сайт, в котором находился неисправный домен контроллер (dc2) и открыв свойства – удаляем его.
Мастер уведомит ещё раз об выполняемых действиях:
Соглашаемся, нажав “Yes”
Далее открываемоснастку Active Directory Users and Computers:
«Start» – «Control Panel» – «Administrative Tools» – «Active Directory Users and Computers»
Разворачиваем C:\Users\ekzorchik>dsquery ou -name “Domain Controllers”
“OU=Domain Controllers,DC=polygon,DC=local” и удаляемучётнуюзаписьсервера dc2.
Далее открываем оснастку DNS Manager:
«Start» – «Control Panel» – «Administrative Tools» – «DNS Manager».
Удаляем все оставшиеся записи DNS: HOST (A) или Pointer (PTR).
Ну вот собственно и все, так следует удалять из DNS и Active Directory записи о удаляемой неисправном контроллере домена и всех его ресурсах. Удачи.
Removing a domain controller by using the Windows interface
You can use the Active Directory Domain Services Installation Wizard to remove a domain controller from an existing domain. If the domain controller hosts any Active Directory–integrated DNS zones, the wizard removes those zones. By default, the wizard also attempts to remove the Domain Name System (DNS) delegations for the zones that point to the domain controller.
Administrative credentials
To perform this procedure, you must be a member of the Domain Admins group in the domain.
To remove a domain controller by using the Windows interface
- Click Start, click Run, type dcpromo, and then press ENTER.
- On the Welcome to the Active Directory Domain Services Installation Wizard page, click Next.
- If the domain controller is a global catalog server, a message appears to warn you about the effect of removing a global catalog server from the environment. Click OK to continue.
- On the Delete the Domain page, make no selection, and then click Next.
- If the domain controller has application directory partitions, on the Application Directory Partitions page, view the application directory partitions in the list, and then remove or retain application directory partitions, as follows:
- If you do not want to retain any application directory partitions that are stored on the domain controller, click Next.
- If you want to retain an application directory partition that an application has created on the domain controller, use the application that created the partition to remove it, and then click Refresh to update the list.
- If the Confirm Deletion page appears, select the option to delete all application directory partitions on the domain controller, and then click Next.
- On the Remove DNS Delegation page, verify that the Delete the DNS delegations pointing to this server check box is selected, and then click Next.
- If necessary, enter administrative credentials for the server that hosts the DNS zones that contain the DNS delegation for this server, and then click OK.
- On the Administrator Password page, type and confirm a secure password for the local Administrator account, and then click Next.
- On the Summary page, to save the settings that you selected to an answer file that you can use to automate subsequent operations in Active Directory Domain Services (AD DS), click Export settings. Type a name for your answer file, and then click Save. Review your selections, and then click Next to remove AD DS.
- On the Completing the Active Directory Domain Services Installation Wizard page, click Finish.
- You can either select the Reboot on completion check box to have the server restart automatically or you can restart the server to complete the AD DS removal when you are prompted to do so.
- Open Server Manager. Click Start, point to Administrative Tools, and then click Server Manager.
- In Roles Summary, click Remove Roles.
- If necessary, review the information on the Before You Begin page, and then click Next.
- On the Remove Server Roles page, clear the Active Directory Domain Services check box, and then click Next.
- On the Confirm Removal Selections page, click Remove.
- On the Removal Results page, click Close, and then click Yes to restart the server.
Removing a domain controller by using an answer file
To remove a domain controller in a domain where other domain controllers exist requires only Domain Admin credentials. You can also create the password for the local Administrator account for the member server. If you do not specify the password in the answer file, the administrator password is blank.
If you are removing AD DS permanently, uninstall the AD DS server role binaries from the server. To remove the AD DS server role binaries, use the dcpromo /uninstallbinaries command.
Administrative credentials
To perform this procedure, you can use any account that has Read and Write credentials for the text editor application.
To create an answer file for removing a domain controller
- Open Notepad or any text editor.
- On the first line, type [DCINSTALL], and then press ENTER.
- Create the following entries, one entry on each line. For a complete list of parameters for removing AD DS, see Demotion Operation or type dcpromo /?:Demotion at a command line.
username=<administrative account in the domain>
userdomain=<domain name of the administrative account>
password=<password for the account in UserName>
administratorpassword=<local administrator password for the server>
removeapplicationpartitions=yes
removeDNSDelegation=yes
DNSDelegationUserName=<DNS server administrative account for the DNS zone that contains the DNS delegation>
DNSDelegationPassword=<Password for the DNS server administrative account>
- Save the answer file to the location on the installation server from which it is to be called by dcpromo, or save the file to a network shared folder or removable media for distribution.
Administrative credentials
To remove a domain controller, you must be a member of the Domain Admins group.
To remove a domain controller by using an answer file
- At an elevated command prompt, type the following command, and then press ENTER:
dcpromo /uninstallbinaries /unattend:"<path to the answer file>"
Removing a domain controller by entering unattended installation parameters at the command line
You can run dcpromo /unattend command on a domain controller to perform an unattended removal of AD DS. If you are removing AD DS permanently, uninstall the AD DS server role binaries from the server. To remove the AD DS server role binaries, use the dcpromo /uninstallbinaries command. For a complete list of parameters for removing AD DS, see Demotion Operationor type dcpromo /?:Demotion at a command line.
To remove a domain controller by using the command line
- At an elevated command prompt, type the following command, and then press ENTER:
dcpromo /unattend /uninstallbinaries /username:<domain admin> /userdomain:<domain> /password:<DA password> /administratorpassword:<local admin password>
Where:
domain admin
is the name of an account that is a member of the Domain Admins group.domain
is the name of the domain for the domain controller.DA password
is the password for the account that is a member of the Domain Admins group.local admin password
is the password that will be used for the local administrator account on the server after AD DS is removed.
The following example removes a domain controller from a domain named contoso.com, removes the AD DS server role binaries, and sets the local administrator password to p@$$w0rd:
dcpromo /unattend /uninstallbinaries /username:DA1 /userdomain: contoso.com /password: DA1_password /administratorpassword: p@$$w0rd
http://technet.microsoft.com/en-us/library/cc771844(WS.10).aspx
Опубликовано 19 Янв 2019 — . В рубрике: Настройка ПО. Теги: PROGRAM.
Резервный контроллер домена нужно вывести из домена и демонтировать виртуальную машину, потому что она постоянно зависает. Точнее зависает не она, о тот Linux на котором она установлена. Сервер в работе, к нему есть доступ. При корректной деинсталяции из домена удалятся все записи об этом контроллере и он ни где не будет фигурировать. Приступим.
В диспетчере удаляемого сервера, он называется WIN-SRV-ST, выбираем опцию – Удалить роли.
Откроется мастер удаления ролей. Читаем – нажимаем >>Далее.
В следующем окне можно увидеть список ролей сервера. С тех ролей, которые нужно удалить, снимаем галочки.
При убирании галочки с пункта Доменные службы Active Directory получаем сообщение: Удаление доменных служб Active Directory невозможно, пока сервер является контроллером домена.
Чтобы удалить AD DC необходимо удалить контроллер домена с помощью мастера установки доменных служб dcpromo.exe. Воспользуемся этой подсказкой.
Для запуска dcpromo пишем его в поисковой строке и запускаем из результатов поиска.
Запустится мастер установки доменных служб Active Directory. Нажимаем >> Далее.
Появившееся сообщение предупреждает о том, что сервер является хранителем глобального каталога.
Чтоб проверить, где еще хранится глобальный каталог переходим в диспетчере сервера по директориям >> Роли >> Доменные службы Active Directory >> Active Directory – сайты и службы >> Sites >> Default-First-Site-Name >>Servers.
По очереди выбираем доступные контроллеры домена, правой кнопкой мыши на NTDS Settings >> Свойства и смотрим, отмечена ли галочка напротив надписи – Глобальный каталог. В данном случае глобальный каталог хранится на всех DC, поэтому с деинсталируемого WIN-SRV-ST его можно удалять.
Возвращаемся к Мастеру dcpromo, нажимаем ОК >> Далее.
В следующем окне галочку не ставим. Наш контроллер домена не последний. >> Далее.
Начнутся проверки необходимости удаления компонентов.
Далее необходимо ввести пароль для новой учетной записи администратора на данном сервере.
Смотрим сводку, подтверждаем удаление нажав >> Далее.
В следующем окне можно отметить галочкой – Перезагрузка по завершении. Мастер выполнит работу и сервер перезагрузится.
После перезагрузки выполняем авторизацию с учетной записью Администратора и новым созданным паролем.
Снова запускаем мастер удаления ролей. Снимаем галочки с ролей: Доменные службы Active Directory и DNS-сервер. На сей раз ни каких предупреждений не появилось. Нажимаем >>Далее.
Подтверждаем удаление компонентов нажав >>Удалить.
Ожидаем, пока выполняется удаление.
Видим результаты удаления. Перезагружаем сервер.
После перезагрузки видим, что удаление прошло успешно.
В итоге роли и службы удалены, сервер больше не является контроллером домена. Виртуальную машину можно демонтировать.