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 8007202B
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
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).
Guy
Recommends: Permissions Analyzer - Free Active Directory Tool
I like the
Permissions Monitor because it enables me to see quickly WHO has permissions
to do WHAT. When you launch this tool it analyzes a users effective NTFS
permissions for a specific file or folder, takes into account network share
access, then displays the results in a nifty desktop dashboard!
Think of all the frustration that this free utility saves when you are
troubleshooting authorization problems for users access to a resource.
'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.
Guy
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.
The extra features you get in your eBook
include, more pages full of detailed examples. Also, ten 'how to...'
sections, with screen shots showing which menus to use. Go for Guy's
eBook - and get a printable version with copy enabled and no expiry date.
Thus utility makes it easy to check the health of a router or firewall. Check the real-time performance and availability statistics for any device
on your network.