Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object not supported for adsi object.get("badPasswordTime")

Status
Not open for further replies.

akmink

MIS
Apr 15, 2002
1
US
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 get the error of "Object does not support this method". This is confusing becouse I can pull the badPwdCount value easily. The only difference
that I can see is that badPwdCount is stored as an Integer and badPasswordTime is an Integer8, a 64 bit value. Everything else is the same, the path, etc. Could
this be my problem, if so how do I fix it? 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 &quot;Syntax error. Usage: cscript lastfail.vbs username domain&quot;
wscript.quit (5555)
end if

Set RegularExpressionObject=New RegExp
With RegularExpressionObject
.Pattern=&quot;CN=&quot;
.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(&quot;LDAP://rootDSE&quot;)
FindNBind=myObj.get(&quot;defaultNamingContext&quot;)
end Function

FindNBind 'Calling the function

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

for each thing in obj
counter=0
tempHolder=thing.name
ReplacedString = RegularExpressionObject.Replace (tempHolder,&quot;&quot;)
dcArray(counter)=ReplacedString & &quot;.&quot; & domain
secondConcat=&quot;LDAP://&quot; & dcArray(counter) & &quot;/CN=&quot; & userName & &quot;,&quot; & &quot;CN=Users,&quot; & dom
set secondObj=GetObject(secondConcat)
badLogin = secondObj.get(&quot;badPasswordTime&quot;) 'this is where I get the error.
wscript.echo badLogin
counter=counter+1
next



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top