Solved

Using dsrm command utility to delete computer accounts

Posted on 2009-06-28
6
1,627 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
  • 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 250 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
In this video we show how to create a mailbox database 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 >> Data…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now