This article will help you to migrate active directory server 2012 to 2022. If you wish to keep the same hardware and the server roles you have already set up without leveling the Windows server, you will have to do an in-place upgrade. In-place upgrades allow us to go from an older operating system to a new one while keeping your settings, server roles, & data thorough.
I am writing this article, to help Windows admin migrate an existing Active Directory which is working on Windows Server 2012 R2 name (DC2012) to Windows Server 2020 name (DC2022). So, let’s get started.
Please visit Microsoft Website for Upgrade Overview
This is a very straightforward procedure, but first, you need to test it in your Test Environment.
In my test lab, I have two Servers and my local domain Server is (xpertstec.local).
Virtual Machine | OS | Role | IP Address |
DC2012 | 2012 R2 | Primary Domain Controller | 192.168.241.150 |
DC2022 | 2022 | Secondary Domain Controller | 192.168.241.160 |
Table of Contents:
Join Server 2022 to Active Directory
Install Additional Domain Controller
Log in with an additional domain controller (DC2022)
Change the alternative DNS server
Check the Master Operation role
Migrating FSMO roles to Windows Server 2022
Change Active Directory Domain Controller
Raise Domain and Forest Function Level
Uninstall Active Directory from Windows Server 2012
Migrate Active Directory Server 2012 to 2022
Log in with an additional domain controller

Change the alternative DNS server
Open your network properties and then change the alternate DNS IP Address.

Check the Master Operation role
Open PowerShell and then enter netdom query fsmo command to check the Master Operation role.

Migrating FSMO Roles to Windows Server 2022 (DC2022)
Launch active directory users and computers, Right-click on the local domain (xpertstec.local), and then select Operations Masters.

Select the RID tab and then click Change.

Click yes

Click ok

Click on the PDC tab and then select Change.

Click Yes

Click OK

Click on the Infrastructure tab and then select Change.

Click Yes

Click OK

Select close

Change Active Directory Domain Controller
Still on the DC2012.xpertstec.local server, launch Active Directory Domain and Trusts, right click on Active Directory Domain and Trusts, and then select Change Active Directory Domain Controller.

Change the Directory Server window, select This Domain Controller or AD LDS instance radio button and select your new Windows Server 2022 which is DC2022.xpertstec.local, and then select ok.

Right click on Active Directory Domains and Trusts and then click on Operations Manager.

Click on the Change button to transfer the domain naming master role to the Windows Server 2022 (DC2022).

Click Yes

Click OK

The Domain naming operations master is now transferred to DC2022.xpertstec.local.

In the DC2022.xpertstec.local server, open PowerShell and then enter regsvr32 schmmgmt.dll to change the Schema Master. Click ok

In the next step, we will change Schema Master, type MMC, and then hit enter.

Change Schema Master Role
Click on the File tab and then select Add/Remove Snap-in.

Add or Remove Snap-ins console, click on Active Directory Schema, click on Add button and then select ok.

In the Console Root, right click on Active Directory Schema and then select Change Active Directory Domain Controller.

Click on DC2022.xpertstec.local server and then select ok.

Click ok to proceed

Now, again, right-click on Active Directory Schema and then select Operations Master.

Choose the Change button to transfer the schema master role to Server 2022 (DC2022.xpertstec.local).

Click Yes

Click ok to proceed

Click Close

Run PowerShell, and then enter netdom query fsmo command. Now all the FSMO roles have been transferred to Active Directory Domain Controller Server 2022.

Transfer FSMO Roles using PowerShell
Transfer the FSMO role to a different Domain Controller. Open PowerShell as admin rights
For Forest wide roles
Get-ADForest | choose schemamaster,domainnamingmaster
For Domain wide roles
Get-ADDomain | select ridmaster,pdcemulator,infrastructuremaster

Change Global Catalog
Launch Active Directory Sites and Services, expand Sites, expand Default-first-site, and then expand DC2022.
Right-click on NTDS Settings and then choose properties

Deselect the Global Catalog box and then click ok.

Domain / Forest Functional Level
Right-click on the local domain and then choose rais domain functional level.

Select the available domain functional level here and then click on raise button.

Click ok

Click ok

Raise forest functional level
Launch active directory domains and trusts
Right-click on it and trust, and then select raise forest functional level.

Select raise

Click ok

Click ok

How to confirm the domain functional levels
Get-ADDomain | fl Name, DomainMode
How to confirm forest functional levels
Get-ADForest | fl Name, ForestMode

Now replace the DNS IP address.

How to uninstall Active Directory from Windows Server 2012 R2
Log in to Server 2012 R2 with domain administrator credentials.
Run PowerShell and then enter the below command.
Uninstall-ADDSDomainController -DemoteOperationMasterRole –RemoveApplicationPartition

Type local administrator credentials, confirm it and then press enter.

Type Y and then press enter.

Be patient. It will complete in few minutes.

The server will be restarted automatically.

After restarting server 2012 R2 please join to workgroup.
Also, read this article: How to Upgrade Windows Server 2012 R2 to Server 2022