Solved

Removing old computer accounts from AD using Powershell

Posted on 2014-01-28
2
2,995 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Synchronize a new Active Directory domain with an existing Office 365 tenant
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 transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…

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

18 Experts available now in Live!

Get 1:1 Help Now