Disable a computer object in AD using PowerShell

Here’s a quick, one-liner for disabling a computer in Active Directory.

Create a text file and put a computername on each line. Make sure you change the path and text file name to point to the text file you created.

get-content d:\textfile.txt | foreach-object {dsquery computer -name $_ | dsmod computer -disabled yes}

email

Written by , Posted .