Subscribe to Windows IT Pro
January 09, 2000 12:00 AM

How can I join a domain from the command line?

Windows IT Pro
InstantDoc ID #13524
Rating: (5)

A. A. The NT Resource Kit Supplement 2 ships a new utility called NETDOM.EXE which can be used to not only join domains, but create computer account and trust relationships.

To join a domain there are 2 paths, the first is to just add the computer to the domain and create the computer account simultaneously which is OK if you are logged on as a domain administrator, if you are not a domain administrator the account needs to be added in advance and then you join the domain.

If you are logged on as a domain administrator then enter the command below to create the account and join the domain

netdom /domain:savilltech /user:savillj /password:nottelling member <computer name> /joindomain
where <computer name> is the name of your machine, e.g. johnstation

If you are not an administrator the domain admin people will have to add you an account first using either server manager or using NETDOM.EXE

netdom /domain:savilltech /user:savillj /password:nettelling member <computer name> /add

Once the account has been add the normal user could join the domain using the first command shown.


Related Content:

ARTICLE TOOLS

Comments
  • Jasen
    2 years ago
    Mar 11, 2010

    Another option is using WMIC.EXE from the command line.

    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 <b>semicolons (;)</b> in your DN instead.

    Example: "OU=testOU; DC=domain; DC=Domain; DC=com"

    <b>Command Line examples</b>

    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.

  • masrule
    5 years ago
    Aug 14, 2007

    GOOD INFO

  • Anonymous User
    7 years ago
    Jun 23, 2005

    Is there any kind of softwares/applications that if we click/run this software, then the client is suceesfully join the NT/Linux (samba/LDAP-samba) domain controller? The client is windows's machine such as win98 and xp.

  • Anonymous User
    7 years ago
    May 12, 2005

    a normel user who can bilt by domainadminstrator

  • Ranjith Kumar.m
    8 years ago
    May 30, 2004

    This article is interesting.I'm looking for these type of articles which are based on command line.Thnaks for the article.

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.