Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

script to delete all the objects in AD.

Posted on 2014-12-16
2
Medium Priority
?
105 Views
Last Modified: 2014-12-18
Hello, I need the script to delete all the objects in AD. I didn't import successfully into the test lab and need to start from scratch.

Could anyone please provide the script to remove all objects from AD.
THanks. No worries. I am doing it in the test lab not in the prod :)
0
Comment
Question by:creative555
[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 Comments
 
LVL 29

Accepted Solution

by:
Dan McFadden earned 2000 total points
ID: 40504509
I wouldn't recommend running a script against AD that deletes all objects.  It would render AD useless.

When you say that you need to start from scratch, do you mean:

1. reinstall server OS
2. dcpromo a server
3. configure first server in forest

Dan
0
 

Author Closing Comment

by:creative555
ID: 40507518
Thanks for the useful comment. It would. I got the script that would delete OUs and all its objects so I can start my lab from the scratch without reinstalling AD.

I used DSRM command and it worked great:
dsrm -subtree -noprompt "OU=Test2OU,DC=test,DC=lab,DC=com"
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

A procedure for exporting installed hotfix details of remote computers using powershell
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

610 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