31 December,2020 by Tom Collins
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
This is only a preview. Your comment has not yet been posted.
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.
Posted by: |