我有一种在Windows 2008 AD上获取用户组的方法。
using (var domainContext = new PrincipalContext(ContextType.Domain, domain, login, pwd))
{
using (var foundUser = UserPrincipal.FindByIdentity(domainContext, IdentityType.SamAccountName, samAccountName))
{
if (foundUser != null)
{
var grs = foundUser.GetGroups(domainContext);
....
}
}
}
该批处理在Windows Server 2003和XP上完美运行,但我在Windows Server 2008上的响应速度很慢:
foundUser.GetGroups(domainContext);
你能帮我解决这个问题吗?
非常感谢