Jul 132008

You can join a Computer or a Member server from the command line usinf the the “netdom” command. This I should say is simpler than the right-click my computer thing. Just one single command will do…

The following procedure should work in Windows Server-2008, Windows Server 2003, Windows Vista, Windows XP. Although, you need the Administrator pack/Support Tools to be installed to get the netdom utility in Windows Server 2003 and Windows XP.

To download the support tools for Windows XP SP2, click here

To download the Administrator pack for Windows Server 2003, click here 

1. Click Start – Run (in Windows Server 2008/Vista, Start-Search and type “Run”)

2. From the command prompt type

C:\Users\administrator> netdom join client1 /domain:hq.wr.com /userd:administrator /passwordd:******

Syntax is

netdom join <ComputerName> /domain:<DomainName> /userd:<UserName> /passwordd:*****

ComputerName is the name of the server that is running the Server Core installation.
DomainName is the name of the domain to join.
UserName is a domain user account with permission to join the domain.
NOTE: Ensure you have the primary DNS server set to your Domain Controller

3. When prompted to enter the password, type the password for the domain user account specified by UserName.

4. Restart the computer for the changes to take effect.

C:\Users\administrator> shutdown /r /t 0

Incoming search terms:

  6 Responses to “How to join a Server/Computer to a Windows Domain from Command Line”

  1. netdom is not available in vista 64-bit

  2. Windows 7 and Vista both have their own NETDOM.EXE, for 32-bit and 64-bit separately.

    You have to install:

    Install RSAT (After you have extracted the tools): (took me awhile to find the link)


    start /w pkgmgr /n:%SystemDrive%\Install\RSAT\Windows6.1-KB958830-x86.xml

    Enable some RSAT tools (including NETDOM)

    start /w pkgmgr /iu:RemoteServerAdministrationTools-Roles-AD-DS-SnapIns;RemoteServerAdministrationTools-Roles-AD-DS;RemoteServerAdministrationTools-Roles-AD;RemoteServerAdministrationTools-Roles;RemoteServerAdministrationTools

    You will then have a “c:\windows\system32\netdom.exe” that supports the ‘older’ Netdom syntax.


    BUT , if you WANT to move it, which i did. you have to do ‘something’ EXTRA.

    To whatever sub-dir you move the RSAT NETDOM.EXE to :

    1) FOR EXAMPLE, create a sub-dir called : %temp%\EN-US


    Then if you execute NETDOM.EXE from “%TEMP%” you should ‘see’ the familiar ‘help’

    NOTE: I have not, as of Dec 8, 2009 actually TESTED the FULL ‘moved’ NETDOM.EXE functionality,
    but WILL in the next day or so,.

    ALSO, someone made the comment that if it was moved’ to another compouter it would not work also,
    I will verify that statement also.

    Hope this helps, as i DONT like the Powershell approach..

    J P Morgan james_p_morgan@hotmail.com

  3. Another option is to use WMIC.EXE, which is included with Windows XP and above.

    I spent days trying to figure out how to use wmic.exe to join the domain. The biggest key was figuring out the syntax as there are a couple of different ways to do it. Importantly, if you specify the AccountOU, you must use the DN as mentioned above. What it fails to mention is that WMIC uses commas (,) to separate paramaters and will cause WMIC to fail. You must use semicolons (;) in your DN instead.

    Example: “OU=testOU; DC=domain; DC=Domain; DC=com”

    Command Line examples

    1. wmic.exe /interactive:off ComputerSystem Where “name = ‘%computername%’” call JoinDomainOrWorkgroup AccountOU=”OU=XP Workstations;DC=my;DC=domain;DC=com” FJoinOptions=1 Name=”my.domain.com” Password=”xyz” UserName=”admin@my.domain.com”

    2. wmic.exe /interactive:off ComputerSystem Where “name = ‘%computername%’” call JoinDomainOrWorkgroup “OU=XP Workstations;DC=my;DC=domain;DC=com”, 1, “my.domain.com”, “xyz”, “admin@my.domain.com”

    Both work, but the first one is easier to edit and the parameters can be in a different order.

  4. > C:\Users\administrator> netdom join client1 /domain:hq.wr.com /userd:administrator /passwordd:******

    Isn’t it an mistake – “/passwordd:******”

  5. No. that’s not a mistake..it indicates that you need to supply domain user password..


  6. all you guys are fucking awesome!! merry christmas guys!

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>