473,385 Members | 1,474 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,385 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 1481

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
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.