我需要查找给定OU中是否存在给定Guid
的计算机。是否可以在“按示例查询”中搜索Guid?
要做到这一点,我宁愿写一个Query By Example来搜索匹配Guid
的计算机。例如:
PrincipalContext context = new PrincipalContext(ContextType.Domain, domain, container);
ComputerPrincipal computer = new ComputerPrincipal(context);
computer.Guid = guidToMatch;
PrincipalSearcher searcher = new PrincipalSearcher(computer);
// Get the computer if it exists...
当然,这是不行的,因为ComputerPrincipal.Guid
场是只读的。此外,ComputerPrincipal.AdvancedSearchFilter
不包含Guid
字段。
这是可能的,还是有一些原因,我不想这样做呢(就像一个更好的选择)?