共用方式為


Dsadd ou

Applies To: Windows Server 2008

Adds a single organizational unit (OU) 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) 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 ou <OrganizationalUnitDN> [-desc <Description>] [{-s <Server> | -d <Domain>}][-u <UserName>] [-p {<Password> | *}] [-q] [{-uc | -uco | -uci}]

Parameters

Parameter Description

<OrganizationalUnitDN>

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

-desc <Description>

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

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

Connects to a remote 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 a asterisk (*) to log on to a remote server. If you type *, you are prompted 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 list explains each format.

  • -uc: Specifies a Unicode format for input from or output to a pipe (|).

  • -uco : Specifies a Unicode format for output to a pipe (|) or a file.

  • -uci: Specifies a 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, "OU=Domain Controllers,DC=Contoso,DC=Com".

  • This command only supports a subset of commonly used object class attributes.

Examples

To create an organizational unit (OU) named Test in the northwindtraders.com, type:

dsadd ou ou=test,dc=northwindtraders,dc=com 

Additional references

Command-Line Syntax Key

Dsadd

Dsadd computer

Dsadd contact

Dsadd group

Dsadd user

Dsadd quota