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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AD Password Expiration

Status
Not open for further replies.

stev379

Technical User
Jan 2, 2005
19
US
I got this script from John Savill at

I edited it for my domain ou structure and it Wscript.echo's the first echo
with correct information for that user, but on line 56 [ Set
objUserConnection = GetObject("LDAP://" &
objRecordSet.Fields("distinguishedName").Value) ], it errors with (null):
0x80005000.

Any idea's how to prevent this error without using On Error Resume Next?

There are a lot of long lines that would cause line wrapping. It's probably
easier for you to visit the link and look at his example.
The only thing I changed was the strRootDomain= string line.

Or if anyone has another script to check when AD users passwords are a certain number of days from expiring...
I prefer a script to third party tools as I'm on a gov campus and have control limited to my OU and not the domain a few levels up.

Thanks for any help or suggestions!
-Steve
 
At that position of the search, the user usually should be existing. Hence, the most probable culpit would be existing some escapeable character in the distinguishedname, if you have that good luck. You could [1] echo it out for visually inspection; and/or [2] try replacing any "/" with "\/".
[tt]
dim s 'put it in a better place if you like
s=objRecordSet.Fields("distinguishedName").Value
s=replace(s,"/","\/")
objUserConnection = GetObject("LDAP://" & s)
[/tt]
 
After re-reading what I posted, I sure missed out the set keyword which should be there of course. The mistake is mine, not Savill here.
[tt]
dim s 'put it in a better place if you like
s=objRecordSet.Fields("distinguishedName").Value
s=replace(s,"/","\/")
[red]set[/red] objUserConnection = GetObject("LDAP://" & s)
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top