?
Solved

Using dsrm command utility to delete computer accounts

Posted on 2009-06-28
6
Medium Priority
?
1,867 Views
Last Modified: 2012-05-07
I am getting an error when I try to delete old computer accounts that are disabled, I get the following error;

Windows cannot delete the object "computer name" because: directory object cannot be found

I have several computer accounts both in the original computers ou and other ou's that
I wanted to cleanup, I'm pretty new at this and stumbled on dsrm. If dsrm is a good
way to remove these accounts can someone give me the exact dsrm verbage to remove these
accounts???

Is there a better way to delete disabled computer accounts????

I'm running Windows 2003 server standard sp2
0
Comment
Question by:jhall0528
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 6

Expert Comment

by:cmccall
ID: 24732045
DSRM is Directory Services Resore Mode.  You don't need this to delete these accounts.  If ADUC won't let you delete, you can try ADSIEDIT.  Make sure you have a good system state backup of a DC before you start this.  But ADSIEDIT should let you delete the old computer accounts.  Just make sure they are definately not being used anymore.
0
 
LVL 27

Accepted Solution

by:
bluntTony earned 1000 total points
ID: 24732778
I think jhall is referring to the command line util DSRM which is used to delete objects from AD, usually by receiving piped DNs from a DSQUERY command.
That aside, a very good utility for cleaning up old computer accounts is oldcmp from Joeware.net http://www.joeware.net/freetools/tools/oldcmp/index.htm.
If you want to delete ALL disabled computer accounts, the syntax would be:
oldcmp -delete -age 0 -onlydisabled -report -sh             (this will show you a report of the computer accounts it will delete)
oldcmp -delete -age 0 -onlydisabled -unsafe -forreal     (this will actually delete them)
 
0
 
LVL 31

Expert Comment

by:Henrik Johansson
ID: 24739313
How was the reference to the computer account submitted when dsrm command was executed?

dsrm nead to have the objectDN as parameter to the command like below

dsrm "CN=computername,CN=computers,DC=domainname,DC=local"
0
 
LVL 27

Expert Comment

by:bluntTony
ID: 24998217
angelIII,
Recommend points split between mine and henjoh09's comments. Henjoh09 has demonstrated the correct syntax for DSRM, while not a complete answer to the original question, whereas my response is a solution, but doesn't use DSRM.
Recommend 50/50 points split.
Thanks,
Tony.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This article explains how to install and use the NTBackup utility that comes with Windows Server.
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…
The video tutorial explains the basics of the Exchange server Database Availability groups. The components of this video include: 1. Automatic Failover 2. Failover Clustering 3. Active Manager
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question