Полезное‎ > ‎CMD‎ > ‎dsmod‎ > ‎

dsmod user


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 | *}]

DS* commands are available on networked machines with the server role A.D. Domain Services installed, Domain Controllers (or for XP users: XP Professional).

The special token $username$, may 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
DSMod - Modify object
DSGet - Display object 
DSMove - Move object
DSQuery - Search for objects 
DSRM - Delete object
CSVDE - Import or export AD info in CSV format.
LDIFDE - Edit AD Objects, extend schema, import or export AD information. 
Q322684 - Directory Service Command-Line Tools