ADmodcmd custom attributes

The -custom switch allows you to name the attribute you wish to modify. This operation is only supported against attributes of the following types:
Boolean, Case Insensitive String, Distinguished Name, DN Binary, IA5-String, Integer, Numerical String, Unicode String.

      [-custom attributeName attributeValue [-multi] | [-remove] ]


   attributeName   The name of the attribute you wish to modify.

   attributeValue  The value to give the attribute.

   -multi (optional)
                   Specifies a multi-valued append.  If the attribute
                   being modified is multi-valued this switch needs to be used.
                   Otherwise, the value will be overwritten, not appended.

   -remove (optional)
                   Specifies a multi-valued remove.  If the attribute being
                   modified is multi-valued and -remove is used, then only
                   the specified value will get removed.

Set the description attribute:

  -custom description "IT Department"


Variable usage is allowed when building attributes. Variables can be based on almost any current Active Directory attribute, as long as it has a value. Variables are seperated from literal values using the % sign. Variables must also be enclosed within a pair of single ticks (').

This example shows how to set homeDirectory to the path c:\test\username, where username is the users sAMAccountName:

-custom homeDirectory c:\test\%'sAMAccountName'%

It is also possible to pull only a specified number of characters from the attribute as well. Just specify the number of characters you want to use after the %, and before the ' The following example shows how to add an SMTP address of

-addsmtp %1'givenName'%.%'sn'

If a % or ' is needed as a literal value, prefix it with a forward slash (/) as an escape character:


This is a percent sign: /%

The above line will display as: This is a percent sign: %

If you need a literal forward slash before the percentage or single tick characters, usually when the forward slash needs to be followed by a variable. The syntax for this is //% or //'
An example would be adding an MS Mail address:

“Seek not every quality in one individual ” - Confucius

Related commands

ADmodcmd - Active Directory Bulk Modify Tool.
Terminal Server AttributesExchange Related AttributesMailbox RightsUser Account Settings

Copyright © 1999-2023
Some rights reserved