Adds a single computer to the directory.

Dsadd is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) or Active Directory Lightweight Directory Services (AD LDS) server role installed. To use dsadd, you must run the dsadd command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

For examples of how to use this command, see Examples.

Syntax

dsadd computer <ComputerDN> [-samid <SAMName>] [-desc <Description>] [-loc <Location>] [-memberof <GroupDN ...>] [{-s <Server> | -d <Domain>}] [-u <UserName>] [-p {<Password> | *}] [-q] [{-uc | -uco | -uci}] 

Parameters

Parameter Description

<ComputerDN>

Required. Specifies the distinguished name of the computer that you want to add. If you omit the distinguished name, dsadd takes the name from standard input (stdin).

-samid <SAMName>

Specifies to use the Security Accounts Manager (SAM) name as the unique SAM account name for this computer, for example, TESTPC2$. If you do not specify this parameter, then dsadd derives a SAM account name from the value of the common name attribute in ComputerDN.

-desc <Description>

Specifies the description of the computer that you want to add.

-loc <Location>

Specifies the location of the computer that you want to add.

-memberof <GroupDN>

Specifies the groups of which you want the computer to be a member.

{-s <Server> | -d <Domain>}

Connects the computer to a server or domain that you specify. By default, dsadd connects the computer to the domain controller in the logon domain.

-u <UserName>

Specifies the user name with which the user logs on to a remote server. By default, -u uses the user name with which the user logged on. You can use any of the following formats to specify a user name:

  • user name (for example, Linda)

  • domain\user name (for example, widgets\Linda)

  • user principal name (UPN) (for example, Linda@widgets.contoso.com)

-p {<Password>| *}

Specifies to use either a password or an asterisk (*) to log on to a remote server. If you type *, dsadd prompts you for a password.

-q

Suppresses all output to standard output (quiet mode).

{-uc | -uco | -uci}

Specifies that dsadd formats output or input data in Unicode. The following table shows each format.

Value Description

-uc

Specifies to use the Unicode format for input from or output to a pipe (|).

-uco

Specifies to use the Unicode format for output to a pipe (|) or a file.

-uci

Specifies to use the Unicode format for input from a pipe (|) or a file.

/?

Displays help at the command prompt.

Remarks

  • If you do not supply a target object at the command prompt, dsadd obtains the target object from standard input (stdin). Dsadd can accept stdin from the keyboard, from a redirected file, or as piped output from another command. To mark the end of stdin data from the keyboard or in a redirected file, use the end-of-file character (CTRL+Z).

  • If a value that you supply contains spaces, use quotation marks around the text, for example, "CN=DC 2,OU=Domain Controllers,DC=Contoso,DC=Com".

  • If you supply multiple values for a parameter, use spaces to separate the values, for example, a list of distinguished names.

Examples

To create a computer account named client01 in the default Computers container of northwindtraders.com, type:

dsadd computer cn=client01,cn=computers,dc=northwindtraders,dc=com