DSMOD User (installable option via RSAT /AD DS)

Modify a user account in active directory.

      dsmod user UserDN [-upn UPN] [-c] [-q] [{-uc | -uco | -uci}] [Options] 

   UserDN   Distinguished name of the user that you want to modify.
            If omitted will be taken from standard input (stdin).

   UPN      User Principal Name of the user, e.g. fred@SS64.com

   -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.


   [-fn FirstName] [-mi Initial] [-ln LastName] [-display DisplayName]
   [-empid EmployeeID] [-pwd {Password | *}]
   [-desc Description] [-memberof Group ...] [-office Office] [-tel PhoneNumber]
   [-email Email] [-hometel HomePhoneNumber] [-pager PagerNumber]
   [-mobile CellPhoneNumber] [-fax FaxNumber] [-iptel IPPhoneNumber]
   [-webpg WebPage] [-title Title] [-dept Department]
   [-company Company] [-mgr ManagersDistinguishedName]
   [-hmdir HomeDirectory] [-hmdrv DriveLetter:][-profile ProfilePath]
   [-loscr LoginScriptPath] [-mustchpwd {yes | no}] [-canchpwd {yes | no}]
   [-reversiblepwd {yes | no}] [-pwdneverexpires {yes | no}]
   [-acctexpires NumberOfDays] [-disabled {yes | no}]
   [{-s Server | -d Domain}]
   [-u UserName] [-p {Password | *}]

To prevent a new password from being displayed on screen, enter it as an asterisk * , DSMOD will then prompt you (twice) to type the new password "blind".

The special token $username$, can be used to replace the SAM account name in the value of the -email, -hmdir, -profile, and -webpg parameters.


Disable freds account:

C:\> set _fred="cn=fred,ou=Users,ou=AcmeCo,dc=ss64,dc=com"
C:\> dsmod user %_fred% -disabled yes

Set the profile path of Fred and Ann using the $username$ token:

C:\> set _ann="cn=AnnSmith,ou=Users,ou=AcmeCo,dc=ss64,dc=com"
C:\> dsmod user %_fred% %_ann% -profile \users\$username$\profile

“A person is a success if they get up in the morning and gets to bed at night and in between does what he wants to do” ~ Bob Dylan

Related commands

DSAdd - Add object. DSAdd User - Add a user to active directory.
DSMod - Modify object.
DSGet - Display object. DSGet User - Display user(s) from active directory.
DSMove - Move object.
DSQuery - Search for objects. DSQuery User - Search for users in active directory.
DSRM - Delete object.
How-to: Reg Tweaks - Registry tweaks and settings for the current user.
ADmodcmd - Active Directory Bulk Modify.
PowerShell: Set-adUser - Modify an AD user.
Equivalent bash commands (Linux): usermod - modify user.

Copyright © 1999-2024 SS64.com
Some rights reserved