how to query changes in Active Directory including deleted objects?

后端 未结 2 745
旧时难觅i
旧时难觅i 2021-01-13 18:52

I am using below code to query changes to users/OUs in AD. But it doesn\'t retrive any deleted objects, Any idea how to include deleted objects in this ?

sta         


        
相关标签:
2条回答
  • 2021-01-13 19:48

    As for as my experience with SearchRequest the filter will not work at any cost, it has its own issue.. and to your case to get Deleted Objects changes you should use Domain Admin privileged account or something like that..

    Here, you need to you give the privileged account who has complete rights over Deleted Objects container.

    System.Net.NetworkCredential cr = new System.Net.NetworkCredential(@"administrator", "xxx", "xxx");
            LdapConnection connection = new LdapConnection(str_dcName);
    
    0 讨论(0)
  • 2021-01-13 19:50

    solution is need to add isDeleted=TRUE to request object

    SearchRequest request = new SearchRequest("DC=xx,DC=xxx,DC=com", 
      "(|(objectClass=organizationalUnit)(isDeleted=TRUE)(objectCategory=Person))",
      SearchScope.Subtree, attribs);
    
    0 讨论(0)
提交回复
热议问题