Solved

Ho do I start fresh and quickly remove about 50,000 objects from test AD that were unsuccessfully imported. Script is needed

Posted on 2014-12-16
7
111 Views
Last Modified: 2014-12-17
Hello,
I did a bad import of objects to the test AD lab and need to remove all objects. They located on many levels and sub OUs. Could you please help me with the script to get rid of them or maybe even the way to just remove entire AD quickly and start fresh.

Thanks
0
Comment
Question by:creative555
  • 4
  • 3
7 Comments
 
LVL 18

Expert Comment

by:Raheman M. Abdul
ID: 40504455
Try this and test on one OU: (To delete a container identified by its DistinguishedName including all child objects)
Remove-ADObject "OU=Finance,OU=London,DC=Mania,DC=COM" -Recursive

Open in new window

0
 

Author Comment

by:creative555
ID: 40505370
Where do I need to run it from? Does it have to be DC? It says unrecognized command
0
 

Author Comment

by:creative555
ID: 40505382
Also, is it possible to load the csv with DN column and specify through the command to remove objects in excel? WHat would be the command?

Thank you
0
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 18

Accepted Solution

by:
Raheman M. Abdul earned 500 total points
ID: 40505396
Yes on DC, start "Powershell with active directory" or use import
otherwise install the active directory module from google
import activedirectory
Remove-ADObject "OU=Finance,OU=London,DC=Mania,DC=COM" -Recursive
                                          

Open in new window

0
 
LVL 18

Expert Comment

by:Raheman M. Abdul
ID: 40505423
Alternatively, follow the steps to completely remove AD from the server.

On DC, run  "dcpromo"
tick "Delete the domain" Next...
tick "Delete all applications..."   Next...

Reboot

Again from server manager, click "Remove Roles"  and uncheck "Active Directory Domain Services" -> Next...
Reboot
0
 

Author Comment

by:creative555
ID: 40505435
DOos it have to be 2008 DC? Can it be 2003 DC?
0
 
LVL 18

Expert Comment

by:Raheman M. Abdul
ID: 40505444
I guess it does not matter.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

707 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