Disjoin Rejoin Windows Server

CycleDude 61 Reputation points
2021-12-24T00:30:28.617+00:00

I have a bunch of Windows 2008 R2 and Windows 2012 R2 that I need to remove from their current domain membership and add them to a new domain. Are there any tools or automated process I use to accomplish this task? Thanks a bunch.

Windows for business | Windows Client for IT Pros | Directory services | Active Directory
Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Anonymous
    2021-12-24T00:33:22.563+00:00

    You can use PowerShell

    Add-Computer -ComputerName Server01, Server02, localhost -DomainName Domain02 -LocalCredential Domain01\User01 -UnjoinDomainCredential Domain01\Admin01 -Credential Domain02\Admin01 -Restart  
    

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/add-computer?view=powershell-5.1#example-6--move-a-group-of-computers-to-a-new-domain

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments

  2. CycleDude 61 Reputation points
    2021-12-24T00:38:48.357+00:00

    @Anonymous Thanks. I tried similar commands. Are there any specific services or software that need to be enabled/ installed on the target servers?

    0 comments No comments

  3. Anonymous
    2021-12-24T00:45:58.733+00:00

    If that doesn't work for you then ADMT may work.
    https://www.varonis.com/blog/active-directory-migration-tool/

    --please don't forget to upvote and Accept as answer if the reply is helpful--


  4. CycleDude 61 Reputation points
    2021-12-24T19:10:29.917+00:00

    @Anonymous Is there a way I can combine the disjoin from the domain on multiple computers, then pause the script for a few minutes then run the next block of line code to add the computers to another domain? I have the samples below, but I am stuck on how I can pass the local administrator user and password once the computer is standalone in a workgroup.

    Disjoin from domain:
    Remove-ADComputer -computername (get-content C:\Temp\servers.txt) -restart

    Join to domain:
    add-computer -computername (get-content C:\Temp\servers.txt) -domainname my.domain.com –credential mydomain\johsmith -restart –force


  5. CycleDude 61 Reputation points
    2021-12-24T19:47:03.05+00:00

    @Anonymous @Limitless Technology

    I looked at ADMT tool but I was hoping I can accomplish this via PS scripting for easier execution. Reading the ADMT notes it makes reference to installing a ADMT Agent to all target computers, which is more than I was hoping to deploy. I appreciate the info on the ADMT; but if someone can suggest a PS scripting way. If it helps all target servers in the domain I want to unjoin them from are running OS versions of Windows 2008 R2 and Windows 2012 R2 and a few Windows 2016.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.