$objOU was defined, but $objDomain was used: $objOU = New-Object System.DirectoryServices.Direc toryEntry("LDAP ://OU=accountin g,DC=domain,DC= local") $objSearcher = New-Object System.Director yServices.Direc torySearcher $objSearcher.Se archRoot = $objDomain Need replace $objDomain with $objOU to get correct result.