I'm working on the AD user management application. C#, UserPrincipal. So I need to add some extra attributes to AD shema, one of them is BirthDate.
Our AD server is 2012 R2 Domain Controller. I'm following the manuals:
- Open mmc.
- Add "Active Directory Shema" to mmc.
- And at this step I must add new Attribute, but I can't. It's not active. There is such menu item like "Add Attribute" to shema, but it's not in the "Enabled" state.
- My account has "Domain Admin" and "Shema Admin" privileges.
- I'v added the DWORD parameter "Schema Update Allowed" with value 1 to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NTDS\Parameters\ and even restarted the server. But I can't add new attribute. What's I'm doing wrong?
Update 1 So, there is a suggestion to use extension attributes. It's the first thing that I did.
[DirectoryObjectClass("user")]
[DirectoryRdnPrefix("CN")]
public class UserPrincipalEx : UserPrincipal
{
private const string _jobTitle = "extensionAttribute1";
[DirectoryProperty(_jobTitle)]
public string JobTitle
{
get
{
if (ExtensionGet(_jobTitle).Length != 1)
return null;
return (string)ExtensionGet(_jobTitle)[0];
}
set
{
this.ExtensionSet(_jobTitle, value);
}
}
}
Then userPrincipal.Save(); cause "System.DirectoryServices.AccountManagement.PrincipalOperationException" with Message"The specified value or attribute directory service does not exist."