0

I am trying to retrieve all the deleted users those are deleted from a particular OU. I am using the below query and it works fine.

string query = string.Format("(&(objectclass=user)(isdeleted=true)(lastknownparent={0}))", ouDn);

When "ouDn" is the value of any available OU, the above query works fine. When I set "ouDn" with a deleted OU distinguishedname(OU=xxxxxx\0ADEL:a82be8cf-1149-4f5b-b42d-fb6c72bceb24,CN=Deleted Objects,DC=xxxx,DC=xxx), I could not get any results but I have deleted users with that lastknownparent in my AD.

Please guide me to how to use deleted OU distinguishedname in the above ldap query.

Albert
  • 43
  • 6
  • Does `(&(objectclass=*)(lastKnownParent=*))` return anything usefull? Possibly you'll need to query the actual DN of the OU before it was deleted. – Daro Jun 22 '13 at 16:52

1 Answers1

1

Maybe I'm a little bit late but I hope this answer will help.

Just replace \0ADEL with \\0ADEL in your LDAP query.

By the way, this rule applies to every attribute with dn syntax.

RX_DID_RX
  • 4,113
  • 4
  • 17
  • 27