PC Review


Reply
Thread Tools Rate Thread

Acoount disabled or not

 
 
Günther Rühmann
Guest
Posts: n/a
 
      1st Feb 2004
Hi,

can anyone give me some code how to query wheather a AD account is disabled
or not? I´d like to use DirectoryServicesEntry object.

Thanks
Guenther


 
Reply With Quote
 
 
 
 
Paul Clement
Guest
Posts: n/a
 
      2nd Feb 2004
On Sun, 1 Feb 2004 16:13:16 +0100, "Günther Rühmann" <(E-Mail Removed)> wrote:

¤ Hi,
¤
¤ can anyone give me some code how to query wheather a AD account is disabled
¤ or not? I´d like to use DirectoryServicesEntry object.

You can check the userAccountControl mask to see if this property is set:

Const ADS_UF_ACCOUNTDISABLE As Int16 = &H2
Dim UserAccountControl As Int16

Dim ADEntry As New DirectoryServices.DirectoryEntry("LDAP://DC=xxx,DC=xxx,DC=org")
Dim ADSearch As New System.DirectoryServices.DirectorySearcher(ADEntry)
Dim ADSearchResult As System.DirectoryServices.SearchResult
ADSearch.Filter = ("(samAccountName=xxxx)")
ADSearch.SearchScope = SearchScope.Subtree
For Each ADSearchResult In ADSearch.FindAll()
UserAccountControl =
CType(ADSearchResult.GetDirectoryEntry().Properties.Item("userAccountControl").Value, Int16)
If CType(UserAccountControl And ADS_UF_ACCOUNTDISABLE, Boolean) Then
Console.WriteLine("Account is disabled")
End If
Next


Paul ~~~ (E-Mail Removed)
Microsoft MVP (Visual Basic)
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: HELP ME !!! TO MAKE THE ACOOUNT !!! David B. Windows Vista Mail 4 21st Jan 2009 09:30 PM
Re: HELP ME !!! TO MAKE THE ACOOUNT !!! Linea Recta Windows Vista Mail 0 13th Jan 2009 12:13 PM
RE: HELP ME !!! TO MAKE THE ACOOUNT !!! Al Windows Vista Mail 0 12th Jan 2009 05:53 PM
Re: HELP ME !!! TO MAKE THE ACOOUNT !!! John Barnett MVP Windows Vista Mail 0 12th Jan 2009 04:58 PM
.Net acoount in XP Adam Windows XP General 1 26th Oct 2003 12:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:31 PM.