Error Code  8007202B – A referral was returned from the server

Troubleshooting Code 8007202B – A referral was returned from the server

Introduction to error Error Code 8007202B

This error code, 8007202B occurs when you execute a VBScript.  My suggestion is that there is a typo in the domain name reference in your script.  Error messages beginning 8007xxxx mean there is an external problem with Windows rather than syntax in the VBScript itself.

The Symptoms You Get 8007202BCode 8007202B A referral was returned from the server

The script does not execute as you hoped, instead you get a WSH error message.  One possibility is that you are using a WSH object and the LDAP reference: dc = value which has been misspelled.

The Cause of Code 8007202B

Your VBScript contains an illegal dc= domain reference, probably a typing mistake, an extra letter.  Check the spelling of your LDAP objects.  In the example the Line: 6 is where the error is to be found.

Ideas for Solutions

A wild guess is that you copied the script, but did not change the domain references which are hard-coded in the script.

Check the spelling of your LDAP objects.  Look for clues particularly the Line: number.  In this case it Char: 1 is not to blame.  When none of the line can execute, the error gets charged to the first character. In the case of runtime errors if you are desperate then use this work around.  Add this line: On Error Resume Next

  ‡

Example 1 – Add the name of your domain control server

Bryan Fuehrer writes in with a great idea; add the name of your domain controller to the script. Instead of a command such as:

Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select Name from ‘LDAP://DC=CEC,DC=root,DC=xyz,DC=com’ " _
& "Where objectClass=’group’"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute

Try this, add the name of the domain contoller, and solve Code 8007202B errors

Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select Name from ‘LDAP://bigserver/DC=CEC,DC=root,DC=xyzd,DC=com’ " _
& "Where objectClass=’group’"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute

Error 8007202B

Note that in Bryan’s example the source is Provider, whereas in my original example the source was (null).  My point is always check your error message carefully.  In this instance there is a different solution depending on what Source: says.  Incidentally, the first 11 lines of Bryan’s script are not shown that is why the error message reports line 14 (not line 3).

Recommended: Solarwinds’ Permissions Analyzer – Free Active Directory ToolFree Permissions Analyzer for Active Directory

I like thePermissions Analyzer because it enables me to see WHO has permissions to do WHAT at a glance.  When you launch this tool it analyzes a users effective NTFS permissions for a specific file or folder, and takes into account network share access, then displays the results in a nifty desktop dashboard!

Think of all the frustration that this free SolarWinds utility saves when you are troubleshooting authorization problems for user’s access to a resource.  Give this permissions monitor a try – it’s free!

Download SolarWinds’ Free Permissions Analyser – Active Directory Tool

Example 2: Typo in the DC=

Error dc= c0p (Where did that zero come from?)

It should be dc= cp

‘Script to Create a new Contact account in the BulkImport OU
‘Script created by Guy Thomas
‘Feel free to adapt names

Set objOU = GetObject("LDAP://OU=BulkImport, dc=c0p, dc=com")
Set objUser = objOU.Create("contact", "cn=SaleMen")
objUser.SetInfo

Wscript.Echo "Success new Contact – Remember F5"

Corrected Version

‘Script to Create a new Contact account in the BulkImport OU
‘Script created by Guy Thomas
‘Feel free to adapt names

Set objOU = GetObject("LDAP://OU=BulkImport, dc=cp, dc=com")
Set objUser = objOU.Create("contact", "cn=SaleMen")
objUser.SetInfo

Wscript.Echo "Success new Contact – Remember F5"

Check all the domain references in your script.  If necessary check ADUC or the System Properties, Computer name tab for the correct domain name.

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:

 

See More Windows Update Error Codes

Error 8007005 Access Denied   •Error 80072EFE Delete Catools2   •Error Code 80072EE2 Windows Update

Error 80048820   •Error 80048821 Windows Live   •Review of SolarWinds Network Monitor

Error 80048823 Windows Live   • Error 8007202B   • Error 80072030   • Error 8007007b

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