Re: Newbie Advice on Schema Change

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Dmitri Gavrilov [MSFT] (dmitrig_at_online.microsoft.com)
Date: 03/26/04


Date: Fri, 26 Mar 2004 12:33:53 -0800

Here is what you need to do:

dn: cn=acmeProfileName,cn=schema,cn=configuration,dc=x
changetype: ntdsschemaadd
objectclass: attributeSchema
lDAPDisplayName: acmeProfileName
attributeId: 1.3.6.1.4.1.999.1.1.28.314355
oMSyntax: 20
attributeSyntax: 2.5.5.4

dn:
changetype: modify
add: schemaUpdateNow
schemaUpdateNow: 1
-

dn: cn=user,cn=schema,cn=configuration,dc=x
changetype: modify
add: mayContain
mayContain: acmeProfileName
-

dn:
changetype: Modify
add: schemaUpdateNow
schemaUpdateNow: 1
-

Note however, that this will fail if you don't have user class imported. It
is possible to have an ADAM without user class. I don't understand your
question re "is there a better class to attach it to". Will your application
function if there are no users?

-- 
Dmitri Gavrilov
SDE, Active Directory Core
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"BryanV" <nobody@nowhere.invalid> wrote in message
news:upRdwr1EEHA.3804@TK2MSFTNGP09.phx.gbl...
>
> I have a requirement that my app read a piece of user configuration data
> from ActiveDirectory.  I am using ADAM to try and prototype this new
> functionality.
>
> I would like to add an attribute to the schema, e.g. acmeProfileName, and
> make this attribute an optional attribute of some schema class that is
> guaranteed to exist.
>
> Question 1:
>
> Is "user" the appropriate schemaClass to attach this new attribute to?
Will
> this class always exist, or is there a better one?  I've seen references
to
> Auxiliary classes, but don't know if that is the way to go.  I'm talking
> about only a single attribute here.
>
> I have succeeded in making an LDIF file to create my new attribute -- that
> part works, since the new attribute shows up in the list of attributes
using
> the ADAM schema editor snap in.  The attribute just does not show up on
> User.
>
> Using the schema editor, I can manually attach that attribute to a class,
> but I have not succeeded in making this association between attribute and
> class using an LDIF file.  I've been using the ms-user.ldf file as an
> example, and trying to find the minimal set of instructions to create my
new
> string attribute, acmeProfileName, and attach it to the user class.
>
> Question 2:
>
> How to I take my new attribute and make it an optional attribute on the
user
> class?
>
> Thanks for any assistance...
>
>
> Here is the LDIF that I use to create the attribute and try to make it
part
> of User:
>
> dn: cn=acmeProfileName,cn=schema,cn=configuration,dc=x
> changetype: ntdsschemaadd
> objectclass: attributeSchema
> lDAPDisplayName: acmeProfileName
> attributeId: 1.3.6.1.4.1.999.1.1.28.314355
> oMSyntax: 20
> attributeSyntax: 2.5.5.4
>
> dn:
> changetype: modify
> add: schemaUpdateNow
> schemaUpdateNow: 1
> -
>
>
> dn: cn=user,cn=schema,cn=configuration,dc=x
> changetype: ntdsschemaadd
> objectClass: classSchema
> mayContain: acmeProfileName
>
> dn:
> changetype: Modify
> add: schemaUpdateNow
> schemaUpdateNow: 1
> -
>
>
> And here is the error-free output from running this on a clean ADAM
> directory to which I have imported ms-user:
> C:\WINDOWS\ADAM>ldifde -i -f ms-user.ldf -s localhost -k -j . -c
> "CN=Schema,CN=C
> onfiguration,DC=X" #schemaNamingContext
> Connecting to "localhost"
> Logging in as current user using SSPI
> Importing directory from file "ms-user.ldf"
> Loading
> entries.................................................................
> .
> 65 entries modified successfully.
>
> The command has completed successfully
>
> C:\WINDOWS\ADAM>ldifde -i -f acmeProfileName.ldf -s localhost -k -j . -c
> "CN=Sch
> ema,CN=Configuration,DC=X" #schemaNamingContext
> Connecting to "localhost"
> Logging in as current user using SSPI
> Importing directory from file "acmeProfileName.ldf"
> Loading entries.....
> 4 entries modified successfully.
>
> The command has completed successfully
>
>


Relevant Pages