Hello, Greetings!
I'm facing issues when try to get the Canonical name of an AD object using its distinguished name. Kindly consider the below c++ snippet,
IADsNameTranslate *pNto = NULL;
HRESULT hr = pNto->InitEx( ADS_NAME_INITTYPE_SERVER ,serverName ,user ,domain ,password);
I receive the error code 80070057 (ERROR_INVALID_PARAMETER) when I provide the IP address of the Domain Controller to 'serverName'.
If I provide the Domain Controller's hostname instead of IP address, it will work without any issues.
Ex:
If I call the InitEx method like:pNto->InitEx( ADS_NAME_INITTYPE_SERVER ,L"192.168.0.1",username ,domain ,password);
then the InitEx method throws "80070057".
If I call the InitEx method like:pNto->InitEx( ADS_NAME_INITTYPE_SERVER ,L"mydcserver",username ,domain ,password);
then the InitEx succeeds.
For some reasons, we couldn't provide the domain controller's hostname.
FYI: I'm using the domain admin credentials
And my questions are,
1. Why it is failing when we use IP address?
2. Is it possible to get the canonical name of an AD object using the domain controller's IP address instead of hostname?
Thanks!