Modify a group in active directory.
Syntax
DSMOD Group GroupDN [-secgrp {yes | no}] [-scope {l | g | u}] [-samid SAMName]
[-desc Description] [{-addmbr | -rmmbr | -chmbr} MemberDN ...]
[{-s Server | -d Domain}] [-u UserName] [-p {Password | *}]
[-q] [{-uc | -uco | -uci}]
Key
Group_DN Distinguished name of the group that you want to add.
If omitted will be taken from standard input (stdin)
-secgrp A security group (yes) or a distribution group (no) default=Yes.
-scope Domain local (l), global (g), or universal (u) default=g
SAMName Unique SAM account name for this group
(By default, the dn attribute from the GroupDN.)
-addmbr Add members to the group
| -rmmbr Remove members from the group
-chmbr Replace members in the group
-s Server Connect to a remote server/domain, default=%logonserver% domain controller.
-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
Examples
Add all members of the Finance group to the Sales group:
C:\> set _finance="CN=Finance Dept,OU=Europe,DC=ss64,DC=com"
C:\> set _sales="CN=Sales Dept,OU=Europe,DC=ss64,DC=com"
C:\> dsget group %_finance% -members | dsmod group %_sales% -addmbr
Add all users from the Europe organizational unit (OU) to the existing group AfricaMarket:
C:\> set _europe="OU=Europe,DC=ss64,DC=com"
C:\> set _AfricaMkt ="CN=AfricaMarket,OU=Africa,DC=ss64,DC=Com"
C:\> dsquery user %_europe% | dsmod group %_AfricaMkt% -addmbr
Add the user Fred to all administrator distribution list groups:
C:\> set _dls="OU=Distribution Lists,DC=ss64,DC=com"
C:\> set _fred="cn=fred,ou=staff,dc=ss64,dc=com"
C:\> dsquery group %_dls% -name adm* | dsmod group -addmbr %_fred%
Add the user Fred to the finance group
C:\> dsmod group %_finance% -addmbr %_fred%
"When people show you who they are, believe them" ~ Maya Angelou
Related:
DSAdd - Add object.
DSMod - Modify object.
DSGet - Display object.
DSMove - Move object.
DSQuery - Search for objects.
DSRM - Delete object.
PowerShell: Set-adGroup - Modify an AD group.
Equivalent bash commands (Linux): groupmod - Modify Group.