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
116 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
[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
  • 4
  • 3
7 Comments
 
LVL 19

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
Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

 
LVL 19

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 19

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 19

Expert Comment

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

Featured Post

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
This article demonstrates probably the easiest way to configure domain-wide tier isolation within Active Directory. If you do not know tier isolation read https://technet.microsoft.com/en-us/windows-server-docs/security/securing-privileged-access/s…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

710 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