Solved

Removing old computer accounts from AD using Powershell

Posted on 2014-01-28
3,625 Views
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
Question by:tballin

LVL 40

Accepted Solution

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}
``````
Input file format...
``````ComputerA
ComputerB
ComputerC
``````
0

Author Comment

ID: 39815963
Perfect!
0

Featured Post

Question has a verified solution.

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