使用任何.NET框架,当我尝试从同一个域,我得到一个错误中添加用户的用户然而添加到一个安全组在Active Directory中
我能够创建安全组。
使用System.DirectoryServices.AccountManagement
:
TheGroup = GroupPrincipal.FindByIdentity(SecurityContext, "GROUPNAME")
TheGroup.Members.Add(SecurityContext, IdentityType.SamAccountName, "username")
TheGroup.Save()
一切工作创造和获取现有的组。还添加成员的作品,但是当我尝试保存到该组由我得到这个错误的更改:
Information about the domain could not be retrieved (1355).
做,现在不使用DirectoryServices.AccountManagement
:
Dim dGroup As DirectoryEntry = GetDirectoryEntry(GroupPath, UserName, Password)
dGroup.Properties("member").Add(nUser.Path)
dGroup.CommitChanges()
dGroup.Close()
再次创建/删除组这样工作正常,但是当我尝试添加一个存在于一个创建的组成员,我得到这个错误:
The server is unwilling to process the request. (Exception from HRESULT: 0x80072035)
布莱恩g到运行AD本身的服务器上,我可以添加组并将用户放入其中。我使用相同的凭据。
**更新** 如果我手动添加用户到SG我想要和尝试在.NET中添加相同的用户它会说它已经存在。但是,如果我删除用户,而不是尝试在.NET中添加他,我会再次出现错误。 “无法检索有关该域的信息(1355)。” :( – chicken 2009-02-19 19:00:44
**更新**现在,当我手动添加一个用户,并试图在.NET中删除它们,当我提交更改时,它有一个问题,我猜这可能是某种远程登录权限问题? – chicken 2009-02-19 19:28:51