Go Premium for a chance to win a PS4. Enter to Win

x
?
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
Medium Priority
?
119 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 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
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
LVL 19

Accepted Solution

by:
Raheman M. Abdul earned 2000 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Screencast - Getting to Know the Pipeline

824 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