How to find Active Directory users with Get-ADUser search filter

31 December,2020 by Jack Vamvas

Question: How can I find a list of Active Directory users with a specific search filter on the name column using Powershell?   In this case I want to find all Active Directory users in the default OU group with a search string.

Answer: Assuming you are in the current Domain group \ OU group , find below an example of the Powershell cmdlet Get-ADUser which will filter on the search string "dba". In this example seaech - the GetADUser cmdlet iterates through the user list looking for any user with the string "dba" in any part of the name.    

Get-ADUser -Filter "name -like '*dba*'" -Properties * | select name

if you need to execute the Get_ADUser search onto another server - than you'll need to use the -server switch

Get-ADUser -Filter "name -like '*dba*'" -Properties  -server "server2.net" | select name

 

If you would like to search for a group use Find Active Directory groups with Get-ADGroup search filter


Author: Jack Vamvas (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on How to find Active Directory users with Get-ADUser search filter


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer