Jorge's Quest For Knowledge!

All About Identity, Security, Recovery And Some Other Mic Stuff – It's Just Like An Addiction, The More You Have, The More You Want To Have!

Archive for the ‘PowerShell’ Category

(2025-11-15) Renaming Domain Controllers – Without Breaking It

Posted by Jorge on 2025-11-15


I have not done this for quit some time, but because of a silly mistake I made in my test lab, I needed to rename the domain controller. Because of how it went, I wanted to share the experience of how it went wrong and also how I solved it.

Many years ago, if you wanted to rename a domain controller you had to use NETDOM. Then after some it was also possible to rename through the GUI, which made it easier. Change name, reboot, done! Obviously PowerShell also support renaming a domain controller.

Because of that, that is what I thought and actually did.

Figure 1: Renaming The Domain Controller

Confirmation it t is renamed after the reboot of the Domain Controller.

Figure 2: Confirmation The Rename Of The Domain Controller Is Effective After The Reboot

However, after trying to log in I see the following error, which was not expected. For sure it had to do with the rename of the Domain Controller. Checking with ADUC on other Domain Controllers, I noticed the computer was not renamed as it still had the old name.

Figure 3: Error During Console log On After Renaming The Domain Controller Through The GUI

I needed to fix this to be able to get in (i.e., log on) and try the command line option. So, from another Domain Controller I connected remotely to the registry of the affected Domain Controller and changed some values to the original name (R1FSRWDC2) as you can see below in figure 4a, figure 4b and figure 4c.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
> Hostname
> NV Hostname
Figure 4a: Changing The Name Back In The TCP/IP Parameters Section

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName
> ComputerName
Figure 4b: Changing The Name Back In The ActiveComputerName Section

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName
> ComputerName
Figure 4c: Changing The Name Back In The ComputerName Section

After these changes, I rebooted the DC, and was then able to log in again! Yeah!

Then I wanted to renamed the domain controller through PowerShell and reboot the Domain Controller

Rename-Computer -NewName R1FSRWDC3 -Restart
Figure 5: Renaming The Domain Controller Through PowerShell

The Domain Controller was renamed, rebooted and after that I could log in as expected. Opening ADUC, I could see the computer account name was also renamed (R1FSRWDC3). DONE!

Figure 6: The Renamed Computer Account Of The Domain Controller In ADUC

Lesson learned? – Use PowerShell on the Domain Controller you need to rename!

Cheers,

Jorge

————————————————————————————————————————————————————-
This posting is provided “AS IS” with no warranties and confers no rights!
Always evaluate/test everything yourself first before using/implementing this in production!
This is today’s opinion/technology, it might be different tomorrow and will definitely be different in 10 years!
DISCLAIMER: https://jorgequestforknowledge.wordpress.com/disclaimer/

————————————————————————————————————————————————————-
########################### IAMTEC | Jorge’s Quest For Knowledge ##########################
#################### https://jorgequestforknowledge.wordpress.com/ ###################

————————————————————————————————————————————————————

IAMTEC

Identity | Security | Recovery

————————————————————————————————————————————————————-

Posted in Active Directory Domain Services (ADDS), PowerShell, Rename, Windows Server | Tagged: , , | Leave a Comment »

(2024-05-01) Delivering A Demo About Reconnecting AD Back With Entra ID At “Troopers 2024”

Posted by Jorge on 2024-05-01


Very proud (again!) to have been selected again to present at Troopers 2024!

Somewhere in the week of June 24th – 28th, I will be challenging the demo gods for a full hour. Let’s just hope everything goes as planned!

Last year at Troopers I presented about the “Best Practices for Resynchronizing AD and Entra ID After Forest Recovery”. This year, I will actually show you how this can be done for real!

For more information about the conference, please see: https://troopers.de/

Cheers,

Jorge

————————————————————————————————————————————————————-
This posting is provided “AS IS” with no warranties and confers no rights!
Always evaluate/test everything yourself first before using/implementing this in production!
This is today’s opinion/technology, it might be different tomorrow and will definitely be different in 10 years!
DISCLAIMER: https://jorgequestforknowledge.wordpress.com/disclaimer/

————————————————————————————————————————————————————-
########################### IAMTEC | Jorge’s Quest For Knowledge ##########################
#################### https://jorgequestforknowledge.wordpress.com/ ###################

————————————————————————————————————————————————————

IAMTEC

Identity | Security | Recovery

————————————————————————————————————————————————————-

Posted in Active Directory Certificate Services (ADCS), Azure AD Cloud Sync, Azure AD Connect, Fixing Identity Data, Forest Recovery, GAP Analysis, GAP Analysis, PowerShell, Tooling/Scripting, Windows Azure Active Directory | Tagged: , , , , , , , , , , | Leave a Comment »

 
Design a site like this with WordPress.com
Get started