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}


Written by , Posted .

Leave a Comment

You must be logged in to post a comment.