【问题标题】:How can I delete a security group from Active directory in .NET?如何从 .NET 中的 Active Directory 中删除安全组?
【发布时间】:2009-02-18 16:06:14
【问题描述】:

如何在 .NET 中从 Active Directory 中删除安全组?

【问题讨论】:

  • 什么版本的框架?

标签: .net active-directory


【解决方案1】:

在 .NET 3.5 中,您可以使用新命名空间 System.DirectoryServices.AccountManagement 并尝试以下操作:

var SecurityContext= new PrincipalContext(ContextType.Domain);
var TheGroup = GroupPrincipal.FindByIdentity(SecurityContext, "GROUP_NAME");
TheGroup.Delete();

显然运行代码的用户需要有删除权限。

【讨论】:

    猜你喜欢
    • 2014-03-24
    • 1970-01-01
    • 1970-01-01
    • 2012-09-09
    • 2011-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多