CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2006
    Posts
    8

    Question Active directory call failing

    Hi All,

    I am trying to add an account into the active directory and then delete it after some time.

    Iam able to add the account successfully into the Domain controller, but, while trying to delete this account iam facing a few problems.

    THe following call is returning S_ ADS_NO_MORE_ROWS even though the account that was created previously is still there in DC.

    hRes = piDS->GetNextRow(hSearch) returns S_ADS_NO_MORE_ROWS.

    I tried to capture the ADsGetLastError output and it says that there is no more data.

    Please advice.

    Regards,
    Harish Reddy.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Active directory call failing

    There is no such a code: S_ADS_NO_MORE_ROWS.
    You probably meant S_ADS_NOMORE_ROWS
    There are some examples in MSDN section "Platform SDK: Directory Services" showing how to perform a directory search... Did you use some of them?

  3. #3
    Join Date
    Mar 2006
    Posts
    8

    Re: Active directory call failing

    Hello Victor,

    Thank you for the reply. I have followed the correct procedure of carrying out the AD search as per MSDN. In my case when iam having a sindle DC for the domain, i am able to properly add and delete account in the AD. But, when iam having more than one domain controller, the deletion operation fails "some times".

    Regards,
    Harish.

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Active directory call failing

    Sorry. I can't help you in this problem...
    Regards,
    Victor

  5. #5
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: Active directory call failing

    Quote Originally Posted by mharishkumarreddy
    Hello Victor,

    Thank you for the reply. I have followed the correct procedure of carrying out the AD search as per MSDN. In my case when iam having a sindle DC for the domain, i am able to properly add and delete account in the AD. But, when iam having more than one domain controller, the deletion operation fails "some times".

    Regards,
    Harish.
    There must be some error return, do you see any error box ?
    Regards,
    Ramkrishna Pawar

  6. #6
    Join Date
    Mar 2006
    Posts
    8

    Re: Active directory call failing

    Let me paste a code snippet for you so that you can better understand the issue:
    IADs* piObject = NULL;

    hRes = ADsGetObject(sCN.data(),
    IID_IADs,
    (PVOID*)&piObject); // sCN is a String

    If hRes is SUCCESS,
    hRes = piObject->QueryInterface(IID_IDirectorySearch, (PVOID*)&piDS);

    If hRes is SUCCESS,
    hRes = piDS->ExecuteSearch((LPWSTR)sFilter.data(),NULL,
    (DWORD)-1,&hSearch);
    If hRes is SUCCESS,
    hRes = piDS->GetNextRow(hSearch))

    Here, even though the account name is present in the Active directory,

    piDS->GetNextRow(hSearch) is returning S_ADS_NOMORE_ROWS in hRes.

    Please advice,

    Thanks,
    Harish Reddy.

  7. #7
    Join Date
    Aug 2004
    Posts
    184

    Re: Active directory call failing

    Looking at the code, you try to bind to the domain and then search for the account you created. If that is correct.......

    In the value for sCN.data() value, do you specify a target domain controller or are you using a serverless bind?

    Domain Controller Specified:

    LDAP: // servername/path to user container

    or Serverless:

    LDAP: // path to user container

    { ignore the extra whitespace in between the LDAP: and the // - I did not want it to show up as a link }

    If you are using a serverless bind, your issue could be nothing more than replication between your two domain controllers. Because it is possible that on the first call you talk to DC1 and then on the second call you talk to DC2.

    If this is not the case, please post the bind dn - sCN.data() and the search criteria - sFilter.data().

    HTH

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured