Windows Server 2016

Windows Server 2016 Server Core the machine is already joined to the domain

In working a lot recently with Windows Server 2016 Core in a lab environment, I ran into an issue after rolling back a snapshot on a Hyper-V Server Core install.  The snapshot rollback of course broke the computer account/domain relationship with the Windows Server 2016 Server Core install.  However, I thought I would simply be able to disjoin the domain and rejoin to reset the computer account.  When attempting to do that, I received the error with Windows Server 2016 Server Core the machine is already joined to the domain.

Windows Server 2016 Server Core the machine is already joined to the domain

The problem as well as that I couldn’t even back the Server Core install off to a Workgroup either.  It still tries to hit the domain when joining a workgroup.  Any domain join/disjoin action leads to the the machine is already joined to the domain error.  Part of my issue was the snapshot of the Hyper-V Server Core host was of a different computer name – the default, automatically generated computer name.

w16scdisjoin01

As you can see below, the orphaned computer account, H2, is there, however, communication with the domain is broken AND the rolled back snapshot is of a different name.

w16scdisjoin02

Let’s see if with some Posh Kung Fu, we can force the removal of the computer from the domain.  Using the script below, still ran into the issue of it knowing the current computer name was different than the domain account.

remove-computer -computername "H2","localhost" -unjoindomaincredential TESTLABadministrator -Workgroup "WORKGROUP" -Restart -Force

w16scdisjoin03

Ok, so let’s try to use the current autogenerated name and see what happens.  This time we receive a different error because the current computer name cannot be mapped to a computer account in the domain.  So are we stuck?

w16scdisjoin04

Let’s see what happens when I simply create a shell computer account of the same name – WIN-NOSNEUISPF1 in the domain and then try the disjoin.

w16scdisjoin06

So, now we have the account created.

w16scdisjoin07

Now, I am going to use the same remove-computer commandlet and also specifying the autogenerated computer name now that we have a dummy computer account in AD.

w16scdisjoin08

Success!

w16scdisjoin09

Amazingly, just simply creating a computer account that it could see with the same name allowed us to disjoin the domain.

Thoughts

If you run into the error with Windows Server 2016 Server Core the machine is already joined to the domain, then most likely you can simply stage a computer account in the domain to reflect what the Windows Server 2016 Server Core thinks the name should be, and then you can disjoin the computer from the domain and then rejoin.  This was quite a lot of grief just to resync with the domain but this simple computer account trick seems to work like a charm.

Subscribe to VirtualizationHowto via Email 🔔

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Brandon Lee

Brandon Lee is the Senior Writer, Engineer and owner at Virtualizationhowto.com and has over two decades of experience in Information Technology. Having worked for numerous Fortune 500 companies as well as in various industries, Brandon has extensive experience in various IT segments and is a strong advocate for open source technologies. Brandon holds many industry certifications, loves the outdoors and spending time with family.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.