H
H
hixr0k2019-09-13 09:59:30
PowerShell
hixr0k, 2019-09-13 09:59:30

Problem using Get-ADUser. How to write a command to get a list of users?

Faced such a problem. When requesting a list of users:

Get-ADUser -Filter * SearchBase 'OU=Отдел, OU=Управление, OU=Департамент, 
OU=Пользователи, OU=ИА, OU=Компания, OU=Регион, DC=test, DC=local'

A message appears that the directory object was not found. Though all specified OU are precisely created.
As soon as I shorten it to:
Get-ADUser -Filter * SearchBase 'OU=ИА, OU=Компания, OU=Регион, DC=test, DC=local'

The list of users starts loading, but if you add another OU to the command:
Get-ADUser -Filter * SearchBase 'OU=Пользователи, OU=ИА, OU=Компания, OU=Регион, DC=test, DC=local'

The message that the object was not found appears again. What could be the reason ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
2
20ivs, 2019-09-13
@hixr0k

Get-ADUser -Filter * SearchBase 'OU=Department, OU=Administration, OU=Department,
OU=Users, OU=IA, OU=Company, OU=Region, DC=test, DC=local'

because most likely messed up with the sequence.
OU=Users, OU=Department, OU=Management, OU=Department, OU=IA, OU=Company, OU=Region, DC=test, DC=local
to understand, go to AD, in the properties of the container in the attribute editor, look for distinguishedName.
and without spaces it is all written.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question