PowerTip: Use PowerShell to Find All AD DS Users

PowerTip: Use PowerShell to Find All AD DS Users

  • Comments 4
  • Likes

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 *

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Lots of great filter options too:

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

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

  • @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.

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

  • @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.