≡ Menu

How to join a computer to domain from command line

We can join a computer to a domain from system properties window. Some times we may need to do this from command line or from a batch file without any user interaction. We can use the tool Netdom.exe in such scenarios.

Below is the command we need to run for joining the machine to a domain.

netdom.exe join %computername% /domain:DomainName /UserD:DomainName\UserName /PasswordD:Password

Here Username and Password should be of a  the domain specified in /domain switch. The user should have privileges to join a computer to the domain.

How to remove a computer from a domain using netdom?

You can run the below command to remove a machine from the domain.

netdom.exe remove %computername% /domain:Domainname /UserD:DomainName\UserName /PasswordD:Password

Download Netdom.exe

5 comments… add one
  • gazza99

    this is not a tool available in windows 7….

    is not recognized as a command in command prompt

    • SomeDude

      I believe you have to move the program to Windows\System32 folder for it to be recognized by command prompt.

      A lot of commands can be added this way.

      To scare you….
      —quote on some forum—

      You have been asking elementary questions about DOS.

      I really doubt that it is safe for you to be putting commands into the heart of the operating system.

      Thank God that it responded with “CPU has encountered an illegal command”.
      Had it been a legal command it would have been executed – and that could have been the death of your operating system.

      You may know that “DEL *.*” can do damage if aimed at the wrong target,
      but there are far worse accidents awaiting those you meddle with system32.

      Windows can deliver more than enough BSOD’s without user interference.
      —end of quote—

    • WingTillDie

      uh…
      Why not use %PATH%

  • yogeshkuamr

    i want to join a computer with domain via command, is it possible to do plz give reply

  • sathish

    how to add computer name to domain to command prompt windows 10

Leave a Comment