How can I remove a user from Active Directory (AD) from the command line without using a script?

A. Windows Server 2003's Dsrm command lets you remove objects from AD. The command syntax is

dsrm <distinguished name (DN) of object to delete>

For example, to delete a user named piggy, you'd type

C:\>dsrm CN=piggy,CN=Users,DC=it,DC=uk,DC=savilltech,DC=com

The computer will ask you to confirm the deletion:

Are you sure you wish to delete CN=piggy,CN=Users,DC=it,DC=uk,DC=savilltech,DC=com (Y/N)? y

If you answer "y", the computer will return the following response:

dsrm succeeded:CN=piggy,CN=Users,DC=it,DC=uk,DC=savilltech,DC=com

To avoid being prompted to confirm the deletion, you can append "-noprompt" (without the quotes) to the end of the command string.

TAGS: Windows 8
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish