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

x
?
Solved

Removing old computer accounts from AD using Powershell

Posted on 2014-01-28
2
Medium Priority
?
5,046 Views
Last Modified: 2014-01-28
Is there a Powershell command or series of commands I can use to remove a text based list of computers from AD?  In other words, I have a text file containing a list of computers that need to be removed from AD.  Any idea how I might do this?
0
Comment
Question by:tballin
2 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 39815937
If you have windows 2008 R2 or later domain controller then you can try..
Import-Module ActiveDirectory
GC C:\input.txt | %{Remove-ADComputer -Identity $_ -confirm:$false}

Open in new window

Input file format...
ComputerA
ComputerB
ComputerC

Open in new window

0
 

Author Comment

by:tballin
ID: 39815963
Perfect!
0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Question has a verified solution.

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

After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
Let's recap what we learned from yesterday's Skyport Systems webinar.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
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…

916 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