About Terminal Server, Citrix, Delphi and other stuff
Ever tried to run a VBS scripts that queries Active Directory in another domain or from a workstation that is not a domain member? Than you have probably seen this error before:
![]()
![]()

This is because the default settings for Chasing referrals is set to ADS_CHASE_REFERRALS_NEVER.
Add the line below to your script to make it work.
So in a script it would look like this:
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCOmmand.ActiveConnection = objConnection
objCommand.Properties("Chase referrals") = ADS_CHASE_REFERRALS_ALWAYS
objCommand.CommandText = _
"Select distinguishedName from " & _
"’LDAP://cn=Configuration,DC=MyDomain,DC=Local’ " _
& "where objectClass=’nTDSDSA’"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Wscript.Echo "Computer Name: " & _
objRecordSet.Fields("distinguishedName").Value
objRecordSet.MoveNext
Loop
No related posts.
Active Directory Altiris bug Citrix Dell Delphi Exchange Exchange2003 Exchange2010 Hewlett-Packard HP iOS Jailbreak Java LinkedIn Linux MSI MySQL Navigation Objects Office Outlook Passat PowerPoint PowerShell referall was returned RNS315 RNS510 SasLibEx script slow Terminal Server ThinApp TSAdmin TSAdminEx VBS VCDS Vista VMWare Volkswagen Windows PE WLAN Wordpress WTSWaitSystemEvent wts_event_flush
WP Cumulus Flash tag cloud by Roy Tanck requires Flash Player 9 or better.
8 Responses for "A referral was returned from the server"
Great hint!
I’ve searched a while to find a solution for this problem!
Dude, you rock! I have been struggling with this one for days and your solution nailed the problem!! Thanks.
Thanks for this hint
I was looking for a solution for this problem long !!
This was an excellent post. Thanks so much for the help.
I’ve been searching and searching for over 6 hours and you solved my problem!!! THANK YOU!
I’ve been really stuck with this problem. You really have dug me out of a very BIG hole. Many thanks for this post. Thank you
Thanks a lot it worked great
Thanks a lot, you save me much time!
Leave a reply