Pull Bad-Password-Time and Bad-Password-Count 
Author Message
 Pull Bad-Password-Time and Bad-Password-Count

Hello,

I am trying to pull the bad password time and count values from AD using
VBScript. These values are not
syncronized, so to get an accurate value I have to pull it from each DC (we
have 8) and compare them. To
do that I am using the URL LDAP format to bind to the copy of AD on each
specific system. I am having
trouble pulling the value, I either get a bad path error or that the value
is not stored in the cache. Here is my
script, can someone help me out? Thanks!

Option Explicit
'On Error Resume Next
dim user
dim userName
dim badLogin
dim dom
dim OU
dim usr
dim concat
dim binder
dim secondConcat
dim tempHolder
dim domain
dim obj
dim secondObj
dim thing
dim thingTwo
dim dcArray(40)      'For Holding DC Names
dim counter
dim secondCounter
dim ReplacedString
dim RegularExpressionObject

if wscript.arguments.count <>2 then
 wscript.echo "Syntax error. Usage: cscript lastauth.vbs username domain"
 wscript.quit (5555)
end if

Set RegularExpressionObject=New RegExp   'Get rid of CN= in DC Name
With RegularExpressionObject
 .Pattern="CN="
 .IgnoreCase=False
 .Global=False
End With

userName = wscript.arguments(0)
domain = wscript.arguments(1)

Function FindNBind()     'Shamelessly stolen from Jeffrey Honneyman
 dim myObj
 set myObj=GetObject("LDAP://rootDSE")
 FindNBind=myObj.get("defaultNamingContext")
end Function

FindNBind      'Calling the function

dom = FindNBind
concat="LDAP://OU=Domain Controllers,"& dom  'DN for Domain Controllers
set obj=GetObject(concat)    'binding to DC's Object

for each thing in obj
 counter=0
 tempHolder=thing.name    'Picked up as CN=Domain Controller Name
 ReplacedString = RegularExpressionObject.Replace(tempHolder,"")
 dcArray(counter)=ReplacedString & "." & domain
 secondConcat="LDAP://" & dcArray(counter) & "/CN=" & userName & "," &
"CN=Users," & dom   ' Bind to each individual DC
 set secondObj=GetObject(secondConcat)
 badLogin = secondObj.get("Bad-Password-Time")
 wscript.echo badLogin
 counter=counter+1
next



Fri, 01 Oct 2004 04:39:53 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Bound Controls: bad,bad,bad

2. RDO bad, bad, bad

3. RDO bad, bad, bad

4. Bad Password Problem - Help!

5. Bad website or bad browser?

6. WHY DOES EVERYONE USE ADO, INSTEAD OF RDO OR DAO. BAD BAD BAD

7. Regular expression - It should be easy, but I am having a bad time

8. Run-time error '49': Bad DLL calling convention

9. run time error "52": bad file name or number

10. bad loading time into combo list (additem)

11. Bad time format string

12. Run-time error '52': Bad file name or number

 

 
Powered by phpBB® Forum Software