AdsOpenObject gives error code 0x8007052e which means invalid credentials

  • Thread starter Thread starter Kalikousik
  • Start date Start date
K

Kalikousik

Guest
Hey im new to windows server and ad ds. I want to authenticate using AdsOpenObject() using activeds.h. I have given the exact credntials and the server name in ad is Default Naming. Here is my code, is my ddistinguished name is correct? i run windows server 2012 r2 in a virtual machine and bridged the network where its ip is 172.24.115.109,and ldap port is 389 should i have to mention the ip and port in the first parameter??
#include <iostream>
#include "activeds.h"

using namespace std;

int main(int argc, char* argv[])
{
HRESULT hr;
IADsContainer *pCont;
IDispatch *pDisp = NULL;
IADs *pUser;
LPWSTR szUsername = NULL;
LPWSTR szPassword = NULL;

CoInitialize(NULL);

hr = ADsOpenObject(L"LDAP://CN=Users,DC=corp,DC=Employees,DC=com",
L"AUsername",
L"Password2@",
ADS_SERVER_BIND, //authentication option
IID_IADs,
(void**)&pUser);


if (SUCCEEDED(hr))
{
cout << "Successfully authenticated";
}
else
cout << "Incorrect username or password";

return hr;
}

Continue reading...
 
Back
Top