Error Code  8000500D -The directory property cannot be found in the cache

Troubleshooting Code 8000500D –
The directory property cannot be found in the cache

Introduction to  Code Error 8000500D

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 8000500DCode 8000500D error

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"

Engineer's Toolset v10Guy Recommends: SolarWinds Engineer’s Toolset v10

This Engineer’s Toolset v10 provides a comprehensive console of 50 utilities for troubleshooting computer problems.  Guy says it helps me monitor what’s occurring on the network, and each tool teaches me more about how the underlying system operates.

There are so many good gadgets; it’s like having free rein of a sweetshop.  Thankfully the utilities are displayed logically: monitoring, network discovery, diagnostic, and Cisco tools.  Try the SolarWinds Engineer’s Toolset now!

Download your fully functional trial copy of the Engineer’s Toolset v10

Example 2 of Code 8000500D Script – The directory property cannot be found in the cache

This problem illustrates that you have to be careful with ‘Get’ command, the property you ask for must exist – therefore, watch out for typos.

The error is on Line 3

Note the misspelling of Context – Contect

Here is the Correct spelling

strDNS =objRootDSE.Get("DefaultNamingContext")

Set objRootDSE = GetObject("LDAP://rootDSE")
‘strADsPath = "LDAP://" & objRootDSE.Get("defaultNamingContext")
strDNS =objRootDSE.Get("DefaultNamingContect")
wscript.echo strDNS

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 https://computerperformance.co.uk/
‘ Version 2.3 – May 2010
‘ —————————————————————‘
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

Solarwinds Free WMI MonitorGuy Recommends: WMI Monitor and It’s Free!

Windows Management Instrumentation (WMI) is one of the hidden treasures of Microsoft operating systems.  Fortunately, SolarWinds have created the WMI Monitor so that you can examine these gems of performance information for free.  Take the guess work out of which WMI counters to use for applications like Microsoft Active Directory, SQL or Exchange Server.

Download your free copy of WMI Monitor


Do you need additional help?

Give something back?

Would you like to help others?  If you have a good example of this error, then please email me, I will publish it with a credit to you:

If you like this page then please share it with your friends