Determine if Active Directory Account is Locked

  • Thread starter Thread starter bsmith
  • Start date Start date
B

bsmith

I would like to determine if an Active Directory user account is
locked. Active directory is running on W2k3 server. I also want to
do this using the DirectoryEntry object. I have read a lot of threads
and there does not seem to be a consistent answer.
 
On 8 Jun 2004 11:45:36 -0700, (e-mail address removed) (bsmith) wrote:

¤ I would like to determine if an Active Directory user account is
¤ locked. Active directory is running on W2k3 server. I also want to
¤ do this using the DirectoryEntry object. I have read a lot of threads
¤ and there does not seem to be a consistent answer.

See if the following works for you:

Dim ADEntry As New DirectoryEntry("WinNT://DomainName/UserAccount")

Console.WriteLine(ADEntry.Properties("IsAccountLocked"))

If I remember correctly, the WinNT provider typically provides the accurate value. I seem to recall
that the LDAP provider does not.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top