PowerTip: Use PowerShell to Find All AD DS Users


Summary: Use a Windows PowerShell cmdlet from the RSAT to find all users in Active Directory Domain Services.

Hey, Scripting Guy! Question How can I easily find all users in Active Directory Domain Services (AD DS)?

Hey, Scripting Guy! Answer Use the asterisk wildcard character with the Get-ADUser cmdlet from the RSAT.

Get-ADUser -Filter *

Comments (6)

  1. mredwilson says:

    @Bart yes you do need to import the ActiveDirectory module if you are using Windows PowerShell 2.0 or earlier. If you are using Windows PowerShell 3.0 or 4.0 then PowerShell automatically imports the module for you.

  2. Greg Bray says:

    Lots of great filter options too:

    Get-ADUser -Filter {name -like "greg*"}

    More filter syntax details at http://www.adminnation.com/…/active-directory-and-powershell-%E2%80%93-speed-up-your-filtering

  3. Ed Wilson says:

    @Greg Bray yes you are right. The cmdlet accepts a couple of different types of filters. It will accept the old LDAP filter syntax (great for migrating a query from and old VBScript or older PowerShell script) as well as the newer PowerShell type of filter syntax. This is a powerful and sophisticated cmdlet.

  4. Bart says:

    Don't forget to import the PowerShell module by using the cmdlet Import-Module ActiveDirectory!

  5. Daniel says:

    Is there a way to list all ACTIVE users, vs. all users?

  6. Jean-Claude DeMars says:

    Active vs in-active depends on what you consider active..

    I used:
    get-aduser -filter * -properties *| where {$_.enabled -eq $true}|

Skip to main content