Quantcast
Channel: Directory Services forum
Viewing all articles
Browse latest Browse all 31638

Issue with LinkID on Linked Custom Attribute Pair in AD

$
0
0

Hi All,

I have a weird issue when creating a linked custom attribute pair in AD.

The process I am following is firstly create the forward attribute with the LinkID of 1.2.840.113556.1.2.50. This apparently auto generates the LinkID. Reload schema and create the back-link attribute using the OID of the forward attribute. This goes all OK apart from when I look at the attribute details, the link ID is a negative number. For example..

The forward attribute is 

The BackLink attribute is

From all the information I have read, the forward attribute link ID should be positive even number and the back-link should be positive odd number. 

I'm using powershell to create the attributes. Forward attribute script is..

$RootDSE = [System.DirectoryServices.DirectoryEntry]([ADSI]"LDAP://RootDSE")
# Retrieve the Schema naming context, the distinguished name of the Schema container in AD.
$SchemaNC = $RootDSE.schemaNamingContext
# Bind to the Schema object.
$Schema = [ADSI]"LDAP://$SchemaNC"

# Create object of class "attributeSchema" with common name "MyCompany-MyAttribute".
$NewAttr = $Schema.Create("attributeSchema", "cn=Test-SoftwareDeliveryPrimaryUser")


$NewAttr.Put("attributeID", "1.2.840.113556.1.8000.2554.1.1")
# Unicode string attribute, similar to the title attribute."
$NewAttr.Put("oMSyntax", 127)
$NewAttr.Put("attributeSyntax", "2.5.5.1")
$NewAttr.Put("isSingleValued", $False)
$NewAttr.Put("isMemberOfPartialAttributeSet", $False)
$NewAttr.Put("searchFlags", 1)
$NewAttr.Put("lDAPDisplayName", "Test-SoftwareDeliveryPrimaryUser")
$newAttr.Put("LinkID", "1.2.840.113556.1.2.50")
# Create the new attribute.
$NewAttr.CommitChanges()

# Assign optional attributes.
$NewAttr.Put("description", "Test AD attribute -Forward")
#$NewAttr.Put("rangeLower", 1)
#$NewAttr.Put("rangeUpper", 128)
# Update the new attribute.
$NewAttr.CommitChanges()

For the Back link, I am using...

$RootDSE = [System.DirectoryServices.DirectoryEntry]([ADSI]"LDAP://RootDSE")
# Retrieve the Schema naming context, the distinguished name of the Schema container in AD.
$SchemaNC = $RootDSE.schemaNamingContext
# Bind to the Schema object.
$Schema = [ADSI]"LDAP://$SchemaNC"

# Create object of class "attributeSchema" with common name "MyCompany-MyAttribute".
$NewAttr = $Schema.Create("attributeSchema", "cn=Test-SoftwareDeliveryPrimaryUser-BL")


$NewAttr.Put("attributeID", "1.2.840.113556.1.8000.2554.1.2")
# Unicode string attribute, similar to the title attribute."
$NewAttr.Put("oMSyntax", 127)
$NewAttr.Put("attributeSyntax", "2.5.5.1")
$NewAttr.Put("isSingleValued", $False)
$NewAttr.Put("isMemberOfPartialAttributeSet", $False)
$NewAttr.Put("searchFlags", 1)
$NewAttr.Put("lDAPDisplayName", "Test-SoftwareDeliveryPrimaryUser-BL")
$newAttr.Put("LinkID", "1.2.840.113556.1.8000.2554.1.1")
# Create the new attribute.
$NewAttr.CommitChanges()

# Assign optional attributes.
$NewAttr.Put("description", "Test AD attribute -Backlink")
#$NewAttr.Put("rangeLower", 1)
#$NewAttr.Put("rangeUpper", 128)
# Update the new attribute.
$NewAttr.CommitChanges()


Environment is a test environment consisting of a single Windows Server 2012 R2 Domain Controller

I could manually declare the LinkID, but I was trying to keep user error out of the equation and thus wanted to use the auto generated method. Anyone one know why I am getting a negative number as a linkID

Thanks for taking the time to read this

Steve


Viewing all articles
Browse latest Browse all 31638

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>