Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5217
  • Last Modified:

Removing old computer accounts from AD using Powershell

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
tballin
Asked:
tballin
1 Solution
 
SubsunCommented:
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
 
tballinAuthor Commented:
Perfect!
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now