Dsrm

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Dsrm

Deletes an object of a specific type or any general object from the directory.

Syntax

dsrm ObjectDN ... [-subtree [-exclude]] [-noprompt] [{-s Server | -d Domain}] [-u UserName] [-p {Password | *}][-c][-q][{-uc | -uco | -uci}]

Parameters
  • ObjectDN ...
    Required. Specifies the distinguished names of objects to delete. If no value is entered at the command prompt, the value will be obtained through standard input.
  • -subtree [-exclude]
    Specifies that both the object and all objects contained in the subtree under that object should be deleted. The -exclude parameter can only be specified along with the -subtree parameter to indicate that the base object given by ObjectDN should be excluded from deletion when deleting the subtree under it. By default, only the base object specified is deleted.
  • -noprompt
    Sets the optional silent mode, which does not prompt to confirm deletion of each object. By default, you are prompted to confirm each deletion.
  • {-s Server | -d Domain}
    Connects to a specified remote server or domain. By default, the computer is connected 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.microsoft.com)

  • -p {Password | *}
    Specifies to use either a password or a * to log on to a remote server. If you type *, you are prompted for a password.
  • -c
    Reports errors, but continues with the next object in the argument list when multiple target objects are specified (continuous operation mode). Without this option, the command exits on the first error.
  • -q
    Suppresses all output to standard output (quiet mode).
  • {-uc | -uco | -uci}
    Specifies that output or input data is formatted in Unicode. The following table lists and describes each format.

    Value Description

    -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 a value that you supply contains spaces, use quotation marks around the text (for example, "CN=Mike Danseglio,CN=Users,DC=Microsoft,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 remove an organizational unit called "Marketing" and all the objects under that organizational unit, type:

dsrm -subtree -noprompt -c OU=Marketing,DC=Microsoft,DC=Com

To remove all objects under the organizational unit called "Marketing," but leave the organizational unit intact, type:

dsrm -subtree -exclude -noprompt -c "OU=Marketing,DC=Microsoft,DC=Com"

Formatting legend

Format Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

See Also

Concepts

Directory service command-line tools
Command-line reference A-Z
Command shell overview