October 30th, 2012

PowerTip: Use a Single Line PowerShell Command to List All Users in an OU

Doctor Scripto
Scripter

Summary: Use a single line Windows PowerShell command to list all users in an OU.

Hey, Scripting Guy! Question How can I list all users in a particular organizational unit (OU)?

      Hey, Scripting Guy! Answer Use the Get-ADUser cmdlet from the ActiveDirectory Module (available from the RSAT tools). Specify the SearchBase as the name of the OU, and use a wildcard pattern for the Filter.

                                    Get-ADUser -Filter * -SearchBase “ou=testou,dc=iammred,dc=net”

                       Note In Windows PowerShell 3.0, you do not have to load a module prior to using it.

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.

Feedback