Using C#, how do you check if a computer account is disabled in active directory?

后端 未结 8 899
暖寄归人
暖寄归人 2020-12-16 17:24

How do you check if a computer account is disabled in Active Directory using C#/.NET

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-16 17:50

    If you are using .NET 3.5, you can use the new System.DirectoryServices.AccountManagment namespace methods to much more easily access Active Directory. The UserPrincipal object has an Enabled property that gives you what you are looking for.

    There is a good overview of these routines in the January 2008 MSDN Magazine. You can read the article online here: Managing Directory Security Principals in the .NET Framework 3.5

提交回复
热议问题