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

后端 未结 8 876
暖寄归人
暖寄归人 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:45

    Without checking bits, adding:

    (userAccountControl:1.2.840.113556.1.4.803:=2)

    to your filter should return only disabled users. Of course,

    (!userAccountControl:1.2.840.113556.1.4.803:=2)

    will ensure that users are not disabled if you'd prefer to go that route.

提交回复
热议问题