草庐IT

GroupPrincipal

全部标签

c# - 使用 C# System.DirectoryServices 在远程 Windows 服务器上进行用户管理

我编写了一个程序,它打开到远程Windows服务器的连接以管理本地帐户(不是ActiveDirectory)。该程序执行以下步骤:用户创建将用户添加到组这两种方法都使用System.DirectoryServices.AccountManagement,这里有两个函数:publicvoidCreateUser(){PrincipalContextpc=newPrincipalContext(ContextType.Machine,"host_ip","adminaccount","adminpassword");UserPrincipalup=newUserPrincipal(pc);

c# - Active Directory 嵌套组

我有一个C#4.0程序可以检索特定AD组的所有成员。在这个AD组中是包含其他成员的其他AD组。我需要我的程序来识别它是一个组并检索该组中的成员。我知道我需要编写一个递归程序,但我希望有人可能已经完成了。如果不是,有人可以告诉我AD属性属性来标识该成员实际上是一个组吗? 最佳答案 由于您使用的是.NET3.5及更高版本,因此您应该查看System.DirectoryServices.AccountManagement(S.DS.AM)命名空间。在这里阅读所有相关信息:ManagingDirectorySecurityPrincipal

c# - 当组(或递归的子组)包含 ForeignSecurityPrincipal 时,GroupPrincipal.GetMembers 失败

这与其说是一个问题,不如说是给遇到同样问题的任何人的信息。出现以下错误:System.DirectoryServices.AccountManagement.PrincipalOperationException:Anerror(87)occurredwhileenumeratingthegroups.Thegroup'sSIDcouldnotberesolved.atSystem.DirectoryServices.AccountManagement.SidList.TranslateSids(Stringtarget,IntPtr[]pSids)atSystem.D

c# - 无法在 System.DirectoryServices.AccountManagement.GroupPrincipal 中转换类型的对象

我在域中使用方法UserPrincipal.Current.ToString()来获取当前登录域用户的有效域。但是当我在一个字符串中显示它时,它在IIS服务器中托管时出现错误:Unabletocastobjectoftype'System.DirectoryServices.AccountManagement.GroupPrincipal'totype'System.DirectoryServices.AccountManagement.UserPrincipal'. 最佳答案 我遇到了同样的问题。它在我的本地机器上运行良好,但是当