Troubleshooting Code 8000500D - The directory property cannot be found in
the cache
Introduction to Code Error8000500D
This error, code 8000500D usually occurs when you execute a VBScript. WSH error codes 80005xxx point to the error being an object outside the VBScript itself. This error is also known as E_ADS_PROPERTY_NOT_FOUND.
My suggestion is that there is a typo in the LDAP reference in your script.
The Symptoms you get 8000500D
When you execute the script you get a WSH message box like this (See diagram). The
VBScript does execute as you hoped.
One possibility is that you are using an LDAP property that has
been misspelt.
The Cause of Code 8000500D
Your VBScript contains an illegal LDAP reference, probably a typing
mistake, maybe an extra letter. Check the spelling of your objects in
the script. Note, a clue in the last line Source: Active Directory.
The Solutions
Double check each of your LDAP objects. In particular, look for naming errors, in this
example it would be in Line: 5. Unfortunately, Char 1: often lies! it just means that
the whole line will not execute.
Another line of attack could be to introduce error correcting code using E_ADS_PROPERTY_NOT_FOUND for example:
Const E_ADS_PROPERTY_NOT_FOUND = &h8000500D
Example 1 of Code 8000500D Script
Note: The Line: 5 deefaultNamingContext
Correction: It should have been defaultNamingContext
'Script to Create a new user account in the GuyDemo OU
'Script created by Guy Thomas
Set oRoot = GetObject("LDAP://rootDSE")
Set oDomain = GetObject("LDAP://" & oRoot.Get("deefaultNamingContext"))
Set oOU=oDomain.Create("organizationalUnit", "ou=GuyDemo")
oOU.Put "Description", "Guy's Script Pure OU"
oOU.SetInfo
Set oUser = oOU.Create("User", "cn=Guy Thomas")
oUser.Put "sAMAccountName", "GuyThomas"
oUser.Put "Description", "Guy's Script made this User"
oUser.SetInfo
oUser.SetPassword "dem0Gu1do"
oUser.AccountDisabled = True
oUser.SetInfo
Wscript.Echo "Success, Check Active Directory Users and Computers - Remember F5"
Example 3 - The phantom space causes : 8000500D Script - The directory property cannot be found in the cache
Problem: objmemberOf = objUser.GetEx("memberOf ")
Solution close up the space objmemberOf = objUser.GetEx("memberOf")
' UsermemberOf .vbs ' To list the groups to which the administrator is a memberOf ' Author Guy Thomas http://computerperformance.co.uk/ ' Version 2.3 - May 2005 '
---------------------------------------------------------------' Option Explicit Dim objRootLDAP, objGroup, objUser, objOU, objmemberOf Dim strOU, strUser, strDNSDomain, strLDAP, strList
'
Commands to bind to AD and extract domain name Set objRootLDAP = GetObject("LDAP://RootDSE") strDNSDomain = objRootLDAP.Get("DefaultNamingContext")
' Build the LDAP DN from strUser, strOU and
strDNSDomain strUser ="cn=Administrator," strOU ="CN=Users," strLDAP ="LDAP://" & strUser & strOU & strDNSDomain
Set objUser = GetObject(strLDAP)
' Heart of the script, extract a list of Groups from memberOf objmemberOf = objUser.GetEx("memberOf ") For Each objGroup in objmemberOf strList = strList & objGroup & vbcr Next
WScript.Echo "Groups for " & strUser & vbCr
& strList
WScript.Quit
' End of Sample User memberOf VBScript
Guy Thomas recommends
Computer Training Software. Their topics and material are ideal for getting you started with VBScript. The
videos are easy to follow and you can control the pace. Try their free demo material and then see if you want to buy the full package.
See more about VB Script Training CD.
Do you have a good example of this error?
If so, then email me I will publish it with a credit to you: