0

我正在开发 AD 用户管理应用程序。C#,用户主体。所以我需要为 AD shema 添加一些额外的属性,其中之一是 BirthDate。

我们的 AD 服务器是 2012 R2 域控制器。我正在遵循手册:

  1. 打开mmc。
  2. 将“Active Directory Shema”添加到 mmc。
  3. 在这一步我必须添加新的属性,但我不能。它不活跃。shema中有“添加属性”之类的菜单项,但它不处于“启用”状态。
  4. 我的帐户具有“域管理员”和“Shema 管理员”权限。
  5. 我已将值为 1 的 DWORD 参数“允许架构更新”添加到 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NTDS\Parameters\ 甚至重新启动服务器。但我无法添加新属性。我做错了什么?

更新 1 因此,建议使用扩展属性。这是我做的第一件事。

[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);
        }
    }
}

然后 userPrincipal.Save(); 导致“System.DirectoryServices.AccountManagement.PrincipalOperationException”和消息“指定的值或属性目录服务不存在。”

4

0 回答 0