Directory Services

Common Errors

All ADSI-specific errors have a hexadecimal form of &H80005xxx. The most common error codes encountered are outlined in the following table.

ADSI Error Code Description
&H80005000 An invalid ADSI pathname was passed. This error results from passing a poorly formed ADsPath to GetObject when binding to an object.
&H8000500D The ADSI property cannot be found in the property cache. This error occurs when enumerating the MandatoryProperties and OptionalProperties properties of a schema class object.
&H8000500E The ADSI object exists. If you attempt to create an ADSI object with the same name as an existing ADSI object, this error will occur.

For a complete list of ADSI error codes, see Generic ADSI Error Codes.

COM Errors

Since ADSI is composed of COM objects, it will return standard COM error codes. The following table lists the COM error codes most commonly encountered in ADSI programming.

COM Error Code Description
&H80004005 Unspecified error. The cause of the COM object failure is indeterminate by ADSI.
&H800041E4 Object not found. This error predominantly occurs due to misspelling the ADsPath string when binding to an object.

See Generic COM Error Codes for a few more examples of COM errors that may occur in ADSI programming.

Win32 Errors

Any error code of the form &H8007xxxx is a standard Win32 error code. If you convert the last four digits from hexadecimal to decimal, you can access the error from the Windows 2000® command line:

net helpmsg number

In the command line above, number is the decimal number obtained by converting the last four digits of the error code from hexadecimal. This command line will provide a more useful description of the Win32 error, which can be of great help in debugging your script.