Announcement

Collapse
No announcement yet.

ADsOpenObject bind unsuccessful

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • ADsOpenObject bind unsuccessful

    I am trying to connect to an AD server from a computer that is outside the domain using ADSI however the bind is unsuccessful. Using Visual c++ 2010 express.

    Here is the code snippet:

    #include "stdafx.h"
    #include <iostream>
    #include <conio.h>
    #include <wchar.h>
    #include <objbase.h>
    #include <activeds.h>
    #include <AdsHlp.h>

    using namespace std;

    int _tmain(int argc, _TCHAR* argv[])
    {
    IADs *pObject;
    HRESULT hr;

    hr = ADsOpenObject(L"LDAP://aswathy-server3/cn=users,dc=aswathy,dc=local",
    L"administrator",
    L"password",
    ADS_SECURE_AUTHENTICATION,
    IID_IADs,
    (void**)&pObject);

    if(SUCCEEDED(hr))
    {
    cout<<"Success";
    pObject->Release();
    }
    else
    cout<<"Unsuccessful";
    getch();
    return 0;
    }

    I have included adsiid,lib and activeds.lib under project properties -> linker -> input -> additional dependencies.

    Does anyone know why bind is not successful?

  • #2
    Re: ADsOpenObject bind unsuccessful

    Hi aswathy92,

    Unfortunately I don't have any skills with C++ and I think most people on the forums are the same.

    The only thing I can think of to check is to verify aswathy-server3 is accessible from the machine running the code. You could try using the FQDN to see if that works.
    Regards,
    Jeremy

    Network Consultant/Engineer
    Baltimore - Washington area and beyond
    www.gma-cpa.com

    Comment


    • #3
      Re: ADsOpenObject bind unsuccessful

      Another thought - if the server is not in the same domain, should your logon be in the format DOMAIN\Administrator ?

      (No C++ skills either )
      Tom Jones
      MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
      PhD, MSc, FIAP, MIITT
      IT Trainer / Consultant
      Ossian Ltd
      Scotland

      ** Remember to give credit where credit is due and leave reputation points where appropriate **

      Comment

      Working...
      X