Active DirectoryMicrosoft TechnologiesWindows Server

The DS Commands – DSMOD

In today post lets look in to another DS command which we can use to administer active directory. Today command is "DSMOD". This command is use to modify the attributes of a object. For example lets assume we need to edit the attributes like Display name, Department of an object or a group of object. This command can easily use for the task.

Another advantage of this command is you can use it combine with DSQuery command. so you can simply search the object and modify the attributes of results it passes.

The common syntax for the command is

dsmod objecttype "ObjectDN" -attribute "New Value"

in here objecttype describe the type of the object. for example if its user account the object type will be user. ObjectDN defines the DN of the object which going to modify. attribute defines the attribute which will be modify.

The help file of the command can be open using dsmod /? and these command need to be run as administrator on DC server.

dsmod1

Lets look in to some of examples using this command.

The first command i am using is dsmod user "CN=Sales B,OU=Sales Department,DC=contoso,DC=com" -email "SalesB@contoso.com" in here i am going to edit the "Email" attribute of the user Sales B and add email address SalesB@contoso.com. before run the command lets check and verify the existing attribute values.

dsmod2

as we ca see it is empty. lets run the command now and see the outcome.

dsmod3

dsmod4

as we can see it successfully updated the attribute.

Also as i mentioned earlier in the post we can use this command along with the DSquery command. lets look how we can use it.

as per demo i will be using dsquery user -name "Sales*" | dsmod user -dept "Sales Department". on this command it will first query all the users who starts the name with text "Sales" and modify the department attribute of all of them and add Sales Department

dsmod5

dsmod6

According to above it successfully modify 5 user objects and we can see its applied on user account Sales C as expected.

This is the end of this post and lets look in to another DS command in next post.

Related posts
Cyber SecurityMicrosoft Entra IDMicrosoft Technologies

Step-by-Step Guide : Process Entra ID Entitlement Management Access Package on-behalf of another user (preview)

Entra ID Entitlement Management access packages enable administrators to offer a self-service…
Read more
Azure servicesMicrosoft Entra IDMicrosoft Technologies

Step-by-Step Guide: Configure Entra ID lifecycle workflow to trigger mover task on user profile changes

The Entra ID lifecycle workflow is a feature of Microsoft Entra ID identity governance and Microsoft…
Read more
Cyber SecurityMicrosoft Entra IDMicrosoft Technologies

Step-by-Step Guide: How to setup Entra ID Restricted management Administrative Units ?

In my previous blog post, I discussed what Entra ID Administrative Units are and how they can be…
Read more
Newsletter
Become a Trendsetter

Sign up and get the best of RebelAdmin, tailored for you.

Leave a Reply

Your email address will not be published. Required fields are marked *