[英]Getting deleted users by lastknownparent in windows active directory using c#
I am trying to retrieve all the deleted users those are deleted from a particular OU. 我正在尝试检索所有从特定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. 当“ ouDn”是任何可用OU的值时,上述查询可以正常工作。 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.
当我使用已删除的OU可分辨名称(OU = xxxxxx \\ 0ADEL:a82be8cf-1149-4f5b-b42d-fb6c72bceb24,CN = Deleted Objects,DC = xxxx,DC = xxx)设置“ ouDn”时,我什么也没得到,但是我在我的广告中删除了具有lastknownparent的用户。
Please guide me to how to use deleted OU distinguishedname in the above ldap query. 请指导我如何在上面的ldap查询中使用已删除的OU可分辨名称。
Maybe I'm a little bit late but I hope this answer will help. 也许我有点迟了,但我希望这个答案会有所帮助。
Just replace \\0ADEL with \\\\0ADEL in your LDAP query. 只需在LDAP查询中将 \\ 0ADEL替换为\\\\ 0ADEL 。
By the way, this rule applies to every attribute with dn syntax. 顺便说一句,该规则适用于具有dn语法的每个属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.