Performing an SCP lookup from a computer not in domain

Hi everybody,

I am using the code given by Microsoft (link: https://www.microsoft.com/en-us/download/details.aspx?id=13082 & https://msdn.microsoft.com/en-us/library/office/dn467395(v=exchg.150).aspx#bk_CodeExample) for SCP Record Lookup. Both links have same implementation. It works when the program is run from a computer in domain. But fails when the program is run from a computer not in domain. Kindly help me in solving this problem. Ask for clarifications if needed.

Thanks & regards,

Amit Jha


April 18th, 2015 1:58pm

To lookup Active Directory you will need LDAP access to a Domain Controller and also Active Directory credentials. That code already allows you pass in the name of the DC you want to access so you only need to modify

 List<string> scpUrls = GetScpUrls(null, domain);

like

 List<string> scpUrls = GetScpUrls("DCServername.domain.com", domain);

Then you need to change the code for the DirectoryEntry class that to use the Username and password see https://msdn.microsoft.com/en-us/library/system.directoryservices.directoryentry.username%28v=vs.110%29.aspx

Cheers
Glen

Free Windows Admin Tool Kit Click here and download it now
April 20th, 2015 3:23am

Hi Glen,

Thanks for the reply. I tried that and it worked fine. But, further in the code (just after some lines)

System.DirectoryServices.DirectorySearcher.FindAll();

gave me error "A referral was returned from the server." I searched for this error, but I am not getting the solution for this.

Note: I am running this program from one domain and querying the AD of other domain.

Kindly help.

April 20th, 2015 9:43am

The referral means the server your querying doesn't have the information your requesting, a few things to try is are you querying a DC that is a Global Catalogue server ? if not try the GC instead. The other thing you can try is to enable referalchasing which should work okay as long as the credentials your using are going to work on the server that your getting referred to see

https://msdn.microsoft.com/en-us/library/ms180884(VS.80).aspx

Cheers
Glen

Free Windows Admin Tool Kit Click here and download it now
April 21st, 2015 12:42am

Hi Glen,

Here is the snapshot which shows that I can log in to the server using ADExplorer as well as the two links mentioned in the question, but when I run

System.DirectoryServices.DirectorySearcher.FindAll();

rectest, it gives me "There is no such object on the server." and 10.55.3.140, it gives me "A referral was returned from the server."

Using ADExplorer, I can login and search the container. Can you suggest some solution to this problem?


April 21st, 2015 3:10am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics