1

I am attempting to create a custom attribute that can be assigned to an existing Active Directory user in my domain. I am not fully aware of how to achieve this. It is my understanding that once the attribute has been created, I can assign it to the user via:

mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, new BasicAttribute("attributeName", "attributeValue"))
ctx.modifyAttributes(userDN, mods)

Any information is appreciated.

1 Answer 1

1

Not sure what you want to do.

But Active-Directory is a Directory, so it use a SCHEMA to define which attributes can be used in an object. This means that you can modify (add, delete, replace) the value of an attribut that exists (in the SCHEMA) for a given class, but can'nt add a custom attribut to a class without modifying the SCHEMA.

Sign up to request clarification or add additional context in comments.

4 Comments

After a little more research, I see what you mean. I believe this is what I need to do Attribute may = new BasicAttribute("MAY", attributeName); Attributes attributes = new BasicAttributes(true); attributes.put(may); DirContext schema = ctx.getSchema(""); // Modify schema object schema.modifyAttributes("ClassDefinition/myObjectClassName",DirContext.ADD_ATTRIBUTE, attributes);
BE CAREFUL, modifying the SCHEMA is quite non Reversible. Most of the time SCHEMA modification are writen in LDIF and tested on virtual machine, before being inserted one time for all in the AD. see the following article
I will be sure to test the schema before using it in the live AD forest. Thanks!
Do you know, that you've got a MMC to modify the SCHEMA in a graphical maner. Then you Export your SCHEMA in Ldif file with LDIFDE.EXE then you import it with the same tool on the final server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.