Solved

Removing old computer accounts from AD using Powershell

Posted on 2014-01-28
2
3,157 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 500 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

This article will help you understand what HashTables are and how to use them in PowerShell.
In this article, I am going to show you how to simulate a multi-site Lab environment on a single Hyper-V host. I use this method successfully in my own lab to simulate three fully routed global AD Sites on a Windows 10 Hyper-V host.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
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 …

932 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