PowerShell: Get-User –OrganizationalUnit One Level?

Question:

Hi I’m trying to get ONE LEVEL of the command Get-User –OrganizationalUnit.

This returns the this-one ou and everything under it, I want a one level return, what paramteres am I missing?

Answer:

Create an array based on distinguished property :

Play around With the index [2] and you will get the OU you search for.
Substring removes the 3 first characters “ou=” in the index.

Source:

PowerShell: Get-User –OrganizationalUnit One Level? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply