Do not use on any
shared computer
May 17, 2008 02:25am pdt
02.19.2007 at 04:44AM PST, ID: 22398331
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

VBScript error 0x80005000 - LDAP query
Tags: ldap, vbscript, query, 0x80005000
hello Experts
Have a VBScript to query LDAP for names, nicks and SMTP addresses. It works just great dumping the contents to a file.
I have adapted it to load directly to a SQL Server db - but it stops after 222 records with the error 0x80005000 - there are about 10k recs to fetch!
The line it stops at is:
If instr(objUser.homemdb,"CN=") <> 0 then
and raises the error - please help! I have looked at all I can think of to find differences between the last record fetched and the following record it trips on - and can find only that the "surname" on the X500 entry is spelt wrongly....

Full routine below:

'On Error Resume Next
Const adOpenStatic = 3
Const adLockOptimistic = 3

Set objRootDSE = GetObject("LDAP://rootDSE")
strDomain = "LDAP://"& objRootDSE.Get("defaultNamingContext")

Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"

Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection

objCommand.CommandText = "<"& strDomain &">;(objectCategory=person)" & _
";distinguishedName,cn;subtree"
objCommand.Properties("Page Size") = 40000

Set objRecordSet = objCommand.Execute

set objSQLConn = CreateObject("ADODB.Connection")
objSQLConn.Open = "Provider=sqloledb;Data Source=myServer;Initial Catalog=myDB;Integrated Security=SSPI;"
objSQLConn.Execute "TRUNCATE TABLE tmpAddresses"

set objRS2 = CreateObject("ADODB.Recordset")
objRS2.Open "SELECT * FROM tmpAddresses",objSQLConn, adOpenStatic, adLockOptimistic

While Not objRecordSet.EOF
strUserDN = objRecordSet.Fields("DistinguishedName")
set objUser = GetObject("LDAP://"& strUserDN)

If instr(objUser.homemdb,"CN=") <> 0 then              ' <--- ERROR raised on this line

For Each entry in objUser.GetEx("proxyAddresses")

If instr(entry,"X400") = 0 Then
proxy1 = replace(entry,"SMTP:","")

If instr(proxy1, "MBX:") = 0 Then
if instr(proxy1,"SMTP:") > 0 Then
if instr(objuser.mailnickname," ") = 0 then

objRS2.AddNew
objRS2.Fields("username").Value = objuser.mailnickname
objRS2.Fields("fullname").Value = objuser.displayname
objRS2.Fields("fname").Value = objuser.givenname
objRS2.Fields("sname").Value = objuser.sn
objRS2.Fields("proxyaddr").Value = proxy1
objRS2.Update

End If
End If
End If
end if
Next

End If

objRecordSet.MoveNext

Wend
objRS2.Close
objConnection.Close
objSQLConn.Close

Set objRootDSE = Nothing
set objRecordSet = Nothing
set objConnection = Nothing
set objCommand = Nothing
set objRS2 = Nothing
set objSQLConn = Nothing
set objUser = Nothing
set objOutputFile = Nothing
set objFSO = Nothing

wscript.Echo "All Done"
Start your free trial to view this solution
Question Stats
Zone: Database
Question Asked By: gbshahaq
Solution Provided By: sirbounty
Participating Experts: 1
Solution Grade: A
Views: 195
Translate:
Loading Advertisement...
02.19.2007 at 08:33AM PST, ID: 18563861

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.20.2007 at 12:31AM PST, ID: 18569026

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.20.2007 at 06:55AM PST, ID: 18570840

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.22.2007 at 02:17AM PST, ID: 18586149

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.22.2007 at 04:36AM PST, ID: 18586850

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.22.2007 at 05:05AM PST, ID: 18587015

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
02.19.2007 at 08:33AM PST, ID: 18563861

Rank: Wizard

What happens if you put back the on error resume next

Then determine what the cause is by adjusting the code like this:

If instr(objUser.homemdb,"CN=") <> 0 then              
msgbox err.Number & vbCrLf & err.Description
?
Accepted Solution
 
02.20.2007 at 12:31AM PST, ID: 18569026
sage advice sirbounty...thankyou!
just had the opportunity to try that out - and of course it works just fine with On Error Resume Next switched on - but trapping the error reveals:

ErrCode: 451
ErrDesc: Object not a collection

I'm happy to accept this right now, but if you could help me troubleshoot the cause it would be appreciated!

Sham
 
02.20.2007 at 06:55AM PST, ID: 18570840

Rank: Wizard

No problem at all - I'd much rather you walk away with an excellent solution, rather than an adequate one! :^ )

I am afraid though, that I may not be able to test similiar situations in my environment, so I may need a bit of detailed information from you as we go along.

But let's start with what we have - object not a collection.

Since we're checking that property for a value ("CN=") then let's see what's in there at all...

If instr(objUser.homemdb,"CN=") <> 0 then              
  msgbox err.Number & vbCrLf & err.Description
  msgbox "Homemdb value is equal to " & objUser.Homemdb & "."
  'Is that simply 'blank'?
  'If so, then you can probably test for it using:
'  If Not IsEmpty(objUser.Homemdb)
'  If Not objUser.Homemdb = ""
   ' before testing for instr...
 
02.22.2007 at 02:17AM PST, ID: 18586149
apologies for getting back to this a bit late:

I've had the opportunity to test this - and each time it trips with the error 451, Homemdb is NOT blank...

I don't actually think I'm missing any records - so i'm not sure I actually have a problem? any further suggestions welcome!
 
02.22.2007 at 04:36AM PST, ID: 18586850

Rank: Wizard

What user is it tripping on?
Perhaps we can test for that and skip that user - to see if it completes processing.
Any difference that you can tell with that user's homemdb property?

The error seems to indicate that the property isn't even there for that user... : \
 
02.22.2007 at 05:05AM PST, ID: 18587015
there's just shy of 30000 recs - and it tripped on about 100.....
i'm going to leave this right now - but thanks for assisting. i'm just getting used to VBScript - and it seems scripts just run better with "On Error Resume Next" at the start....
 
 
20080206-EE-VQP-25