DSRM.exe – Windows CMD Command

Delete objects from active directory.

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

Key
   ObjectDN  Distinguished name of the group that you want to remove.
             If omitted will be taken from standard input (stdin)

   -subtree  Delete the object and all objects contained in its subtree.
   -exclude  Delete all objects contained in the subtree, but not the object itself.

   -noprompt Do not prompt to confirm deletion.

   -s Server Connect to a remote server/domain, default=%logonserver% domain controller.

   -c        Continue with the next object after any error (when you specify multiple target objects)
             by default dsrm will exit when the first error occurs.

   -q        Quiet, suppress all output

   -uc       Unicode format
   -uco      Unicode format for output only
   -uci      Unicode format for input only
Examples

Remove all objects under the OU AcmeCo, but leave the OU intact:

C:\> dsrm -subtree -exclude -noprompt -c "OU=AcmeCo,DC=F4T,DC=Com"

Find all the computer objects that have been inactive in AD for the last 52 weeks and remove them:

C:\> dsquery computer -inactive 52 | dsrm -noprompt

You may also like...

2 Responses

  1. zortilo nrel says:

    You have brought up a very superb details , appreciate it for the post.

  2. frolep rotrem says:

    I really like your writing style, good information, regards for posting : D.

Leave a Reply

Your email address will not be published. Required fields are marked *