Scenario You made an awesome list of old computers and now you want to delete these computers using PowerShell for the sake of cleaning up AD. The Script Here you go: Import-Module ActiveDirectory Get-Content C:\scripts\to-delete.txt | % { Get-ADComputer -Filter { Name -eq $_ } } | Remove-ADObject -Recursive -WhatIf Explanation Separate each action by the pipe, that's the little thing that looks like | Get-Content is where you'll grab the information in the text file. Mine was … [Read more...] about PowerShell script to remove all Active Directory computers in a list
You are here: Home / Archives for WhatIf
Recent Activity