Code Error 80005000 – An Invalid ADSI Pathname Was Passed

Troubleshooting Code Error 80005000 – An invalid ADSI pathname was passed

My main interest is in VBScript code errors, however code 80005000 is also a common error when installing Exchange.  The common thread is an error with the directory pathname.  This error is also referred to as E_ADS_BAD_PATHNAME.

Two variations of Code Source: 80005000  Errors

  1. An invalid ADSI pathname was passed (Exchange).
  2. An invalid directory pathname was passed (VBScript)

  ‡

1) An invalid ADSI pathname was passed

When you run Microsoft Exchange 2003 (2000) Server Setup with the /forestprep switch, the installation fails and you may receive the above error message.

The Cause of error 80005000 in Exchange

You run setup /forestprep, but it does not complete properly.  Active Directory ‘flags’ that it has been run, but in reality it did not finish.

Check the server progress log for entries like.

(G:\admin\src\udog\setupbase\basecomp\baseatom.cxx:775)
Error code 0X80005000 (20480): An invalid ADSI pathname was passed.

The Solution for Exchange

Open ADSI Edit.
Navigate to this location under the Configuration container:
CN=Configuration; CN=Services; select CN=Microsoft Exchange

Right-click CN=Microsoft Exchange, and then click Properties. From the Attributes tab, under Select which properties to view, click Both.
From the Select what property to view pull-down menu, select Heuristics.
If the value is set to 2, then you have already run ForestPrep.

Solution, reset the Heuristics property, click Clear, and then click Apply. The Value(s) field will have change to ‘not set’.

Exchange Monitor from SolarWindsGuy Recommends: The SolarWinds Exchange Monitor

Here is a free tool to monitor your Exchange Server.  Download and install the utility, then inspect your mail queues, monitor the Exchange server’s memory, confirm there is enough disk space and check the CPU utilization.

This is the real deal – there is no catch.  SolarWinds provides this fully-functioning freebie, as part of their commitment to supporting the network management community.

Free Download of SolarWinds Exchange Monitor

2) Error Code 80005000 in VBScript

This variation of error code 80005000 occurs when you execute a VBScript.

Error: An invalid directory pathname was passed

Source: Active Directory

The Symptoms You Get 80005000

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 object which has been misspelled.  Another cause could be missing speech marks in a value.WSH Code: 80005000 Error VBScript

The Cause of Code Error 80005000

Your VBScript contains an illegal LDAP reference, probably a typing mistake, maybe an extra letter.

In this particular instance there is a knock on effect of a variable not being properly declared.  When the script needs to use the variable in line 8, WSH flags the error as Code 80005000.

The Solutions to Error 80005000

Check the spelling of all your objects and methods.  Look for clues particularly in the Line: x number.  However, in this particular example the root cause is earlier in line 4.

Another plan would be to introduce error correcting code using E_ADS_BAD_PATHNAME for example:

Const E_ADS_BAD_PATHNAME= &h80005000

See more on ADSI properties.

Guy Recommends:  SolarWinds’ Free Bulk Import ToolFree Download Solarwinds Bulk Import Tool

Import users from a spreadsheet.  Just provide a list of the users with their fields in the top row, and save as .csv file.  Then launch this FREE utility and match your fields with AD’s attributes, click and import the users.

Optionally, you can provide the name of the OU where the new accounts will be born. Download your FREE bulk import tool.

If you need more comprehensive software, download a free trial of SAM (Server & Application Monitor)

Example of a Script with Error 80005000

Briefly, the idea of the script is to create a new user using the variable guyname.  The problem is that the value of guyname is not in speech marks.

Problem Line 4 – strNewUser = bilbo277
Solution Line 4 – strNewUser = "bilbo277"

‘CREATE USER AND SET PASSWORD
Dim strNewUser, strPasswd

strNewUser = bilbo277
strPasswd = Pa$$w0rd
Set objOU=GetObject("LDAP://ou=Droitwich,dc=cp,dc=com")
set objUser = objOU.Create("User","cn="& strNewUser)
objUser.Put "sAMAccountName","bilbo577"
ObjUser.SetInfo
objUser.SetPassword strPasswd

Solution with double quotes around the variable.

‘CREATE USER AND SET PASSWORD
Dim strNewUser, strPasswd

strNewUser = "bilbo277"
strPasswd = Pa$$0rd
Set objOU=GetObject("LDAP://ou=Droitwich,dc=cp,dc=com")
set objUser = objOU.Create("User","cn="& strNewUser)
objUser.Put "sAMAccountName","bilbo577"
ObjUser.SetInfo
objUser.SetPassword strPasswd

Another Example of Error 80005000

The problem is the order of group, domain

The correct sequence is group, domain.  Also ou, domain.

Perhaps you can spot the error on line 16, domain, strContainer.

‘ GroupEnum.vbs
‘ Sample VBScript to discover who is a member or the Administrators
‘ Author Guy Thomas https://computerperformance.co.uk/
‘ Version 1.2 May 2010
‘ ———————————————————-‘
Option Explicit
Dim strMember, strDNSDomain, strContainer
Dim objGroup, objRootDSE, arrMemberOf

‘ Bind to Active Directory’
strContainer = "cn=Administrators,cn=Builtin, "
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")

‘ Get the Builtin Administrators group
Set objGroup = GetObject ("LDAP://" & strDNSDomain & strContainer )
objGroup.getInfo

arrMemberOf = objGroup.GetEx("member")

‘ Loop = For Each …. Next
WScript.Echo "Members of Group " & strContainer
For Each strMember in arrMemberOf
WScript.echo strMember
Next

Wscript.Quit

‘ End of Sample Group Enum Member Script

Another Example of Error 80005000

‘ GroupEnum.vbs
‘ Sample VBScript to discover who is a member or the Administrators
‘ Author Guy Thomas https://computerperformance.co.uk/
‘ Version 1.2 May 2010
‘ ———————————————————-‘
Option Explicit
Dim strMember, strDNSDomain, strContainer
Dim objGroup, objRootDSE, arrMemberOf

‘ Bind to Active Directory’
strContainer = "cn=Administrators,cn=Builtin, "
Set objRootDSE = GetObject("LDAP://RootDSE")
strDNSDomain = objRootDSE.Get("DefaultNamingContext")

‘ Get the Builtin Administrators group
Set objGroup = GetObject ("LDAP://" & strContainer & strDNSDomain )
objGroup.getInfo

arrMemberOf = objGroup.GetEx("member")

‘ Loop = For Each …. Next
WScript.Echo "Members of Group " & strContainer
For Each strMember in arrMemberOf
WScript.echo strMember
Next

Wscript.Quit

‘ End of Sample Group Enum Member Script

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