Modify a computer object in active directory.
Syntax
DSMOD computer Computer_DN -reset -disabled [-c] [-q] [{-uc | -uco | -uci}] [options]
Key
Computer_DN Distinguished name of the computer that you want to add.
If omitted will be taken from standard input (stdin)
-reset Reset computer account
-disabled {yes | no} Disable the computer account for logon
-c Continue with the next object after any error (when you specify multiple target objects)
by default dsmod will exit when the first error occurs.
-q Quiet, suppress all output
-uc Unicode format
-uco Unicode format for output only
-uci Unicode format for input only
Options
-desc Description
-loc Location
{-s Server | -d Domain} By default, connects the computer to the domain controller in the logon domain.
-u UserName The user name with which a user logs on to a remote server.
By default, the currently logged on user.
-p {Password | *}
Examples
Disable multiple computer accounts (CMD shell)
C:\> set _mc1="CN=ServerA,CN=Computers,DC=ss64,DC=Com"
C:\> set _mc2="CN=ServerB,CN=Computers,DC=ss64,DC=Com"
C:\> dsmod computer %_mc1% %_mc2% -disabled yes
Reset multiple computer accounts (powershell)
PS C:\> $mc1 = "CN=ServerA,CN=Computers,DC=ss64,DC=Com"
PS C:\> $mc2 = "CN=ServerB,CN=Computers,DC=ss64,DC=Com"
PS C:\> dsmod computer $mc1 $mc2 -reset
“If you want a thing done well, do it yourself” ~ Napoleon Bonaparte
Related commands:
DSAdd - Add object.
DSMod - Modify object.
DSGet - Display object.
DSMove - Move object.
DSQuery - Search for objects.
DSRM - Delete object.
PowerShell: Set-adComputer - Modify an AD computer.