Você só precisa usar o parâmetro -SearchScope
e passar o argumento OneLevel
para dizer ao comando para não atravessar o valor padrão SubTree
que leva se você não especificar nenhum parâmetro e valor -SearchScope
.
Então, basta incluir: Get-ADUser -Filter * -SearchScope OneLevel <Rest of your command>
Exemplo do PowerShell
$SearchBase = "OU=Department,DC=Company,DC=COM"
Get-ADUser -Filter * -SearchScope OneLevel -SearchBase $SearchBase -Properties employeeID,displayName,surname,givenname,physicalDeliveryOfficeName,title,department,company,memberof
Mais recursos
-
-SearchBase
When the value of the SearchBase parameter is set to an empty string and you are connected to a GC port, all partitions will be searched.
-
-SearchScope The scope of an AD search. Possible values for this parameter are: Base or 0 Search only the current path or object. OneLevel or 1 Search the immediate children Subtree or 2 Search the current path/object and all children
source