473,322 Members | 1,398 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Bad password count is inaccurate

I am attempting to retrieve the bad password count from active directory.
However, the results seem to be incorrect. Any help with this would be
appreciated.

Robert Adrian
Raven Inc.

Public Function GetBadPasswordCount(ByVal distinguishedName As String) As
Integer
Dim Total As Integer = 0
Dim Counter As Integer = 0

If m_DomainControllers Is Nothing Then
GetDomainControllers()
End If

Dim Filter As String = "(&(objectClass=user)(objectCategory=person))"

Dim DE As DirectoryEntry
DE = New DirectoryEntry()
DE.AuthenticationType = m_DSAuthenticationType
DE.Username = m_DSUsername
DE.Password = m_DSPassword

Dim Searcher As New System.DirectoryServices.DirectorySearcher()
Searcher.SearchScope = SearchScope.Subtree
Searcher.ReferralChasing = ReferralChasingOption.All
Searcher.PropertiesToLoad.Add("badPwdCount")
Searcher.Filter = Filter

For Counter = 1 To m_DomainControllers.Count
Dim DomainController As String = m_DomainControllers(Counter)

Dim Path As String = "LDAP://" & DomainController & "/" &
distinguishedName
DE.Path = Path

Searcher.SearchRoot = DE

Dim Search As SearchResult = Searcher.FindOne
Dim Entry As DirectoryEntry = Search.GetDirectoryEntry

If Not Entry.Properties("badPwdCount").Value Is Nothing Then
Total = Total + Entry.Properties("badPwdCount").Value
End If

Entry.Close()
Next

DE.Close()
Return Total
End Function
Jul 21 '05 #1
0 1475

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: SG | last post by:
Is there a stored procedure or query that will count all the records in all my tables in a database? Many thanks Sam
4
by: avillela | last post by:
I'm looking for a password generator. example: I pass as parameter a string and the function return a password.(string) can anyone provide me any password generator ???? thanks André -...
2
by: Steve Bottoms | last post by:
Is there any way to pass a login name/password when calling System.Web.Mail.SMTPMail? Can't find anything in the docs or KB... If not, any suggestions to get this functionality short of building...
0
by: Robert Adrian | last post by:
I am attempting to retrieve the bad password count from active directory. However, the results seem to be incorrect. Any help with this would be appreciated. Robert Adrian Raven Inc. Public...
11
by: Bob Stearns | last post by:
My client is bugging me for a solution to this problem! I am still getting "Password Invalid" with all new users I define on my linux box. I have tried all the suggestions made here and they made...
15
by: Eugene Anthony | last post by:
Is this method of validation for password and username considered to be secured. In my previous post I was given a solution that uses command object and the values are parsed by parameters. But the...
11
by: Kevin O'Brien | last post by:
Hello, I am creating a sign on screen for my application in which I want to store the username and password in a database table. I was thinking of putting a combo box connected to the database...
4
by: apondu | last post by:
I'm trying to screen scrape a site that requires a password. I am using C#.Net, i am new to this and with the information available around on the internet i just put tht information into the...
5
ddtpmyra
by: ddtpmyra | last post by:
I need some help to review my code add more security on in. Scenario: Login Page enter username enter password Display Page if log-in success display all the records from mysql server
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.