C# enable user account with DirectoryEntry

前端 未结 1 584
孤街浪徒
孤街浪徒 2021-01-19 05:57

I want to know if user account enable. I use this code:

  var usersList = new List();
  DirectoryEntry localMachine = new DirectoryEntr         


        
1条回答
  •  迷失自我
    2021-01-19 06:11

    You're using the WinNT:// provider, which is very limited in its abilities. It doesn't support many of the usual properties that the full-blown LDAP:// provider has - and I would think that's probably the reason why this code setting userAccountControl (which is an LDAP attribute, most likely not present and not support on a local user account) doesn't work.

    See Richard Mueller's article WinNT vs. LDAP for a lot more information on what WinNT:// can do (or cannot do)

    0 讨论(0)
提交回复
热议问题