In this Azure PowerShell article, we will discuss the syntax and usage of the Get-aduser PowerShell command with examples of how to use this command.
Table of Contents
Get-aduser
Whenever there is a requirement to find Active Directory (AD) users in your domain, the Get-Aduser PowerShell command can help you quickly find the AD users in your domain.
Syntax of Get-aduser
Below is the syntax of the Get-ADUser PowerShell command.
Get-ADUser Get-ADUser -Filter <String>There are some Prerequisites needed to work with the Get-Aduser PowerShell command.
Prerequisites
Below are some Prerequisites needed to work with the Get-Aduser PowerShell command
- You must log in with an AD user account
- Make sure you have the PowerShell Active Directory module installed on your machine
Let’s discuss a few examples of how to use the Get-ADUser PowerShell command.
There are different ways to use the Get-Aduser PowerShell command

If you are facing this issue, fix the error The term ‘get-aduser’ is not recognized as the name of a cmdlet in Windows 10 PowerShell.
Find a User Account With an Identity
The Identity parameter helps you to retrieve the user quickly from your domain, and the only thing is you need to know the name of the user that you have to send as a parameter along with the Get-AdUser PowerShell cmdlet.
You can use parameters like Name, SAMAccountName, SID, GUID, etc.
Example:
PS C:\WINDOWS\system32> Get-ADUser -Identity BijayOr
PS C:\WINDOWS\system32> Get-ADUser -Identity 'T-l-7-21-58745555-3432493942-33333458655-5166'Or
PS C:\WINDOWS\system32> Get-ADUser -Identity 'CN=Bijay,OU=HR,DC=HRC,DC=localGet-ADUser – Filter
If you don’t know the name and want to retrieve the user based on some filter condition then you can use the -Filter and LDAPFilter parameter. You can use different identifiers like the Where-Object and given name, etc.
Example
PS C:\WINDOWS\system32> Get-AdUser -Filter "givenName -eq 'Bijay'"Get-AdUser With Properties Parameter
You can also use the Get-AdUser with the Properties Parameter. The Property parameter can be used with one or more comma-delimited attributes. You can also use the Property parameter with the given name.
Example– Get all of the properties for a specific user
Get-AdUser -Filter "givenName -eq 'Bijay'" -Properties *Get-AdUser with OU
You can also use the Get-AdUser to filter by OU; for that, you need to use the SearchBase parameter with the Get-AdUser command. The SearchBase helps you to begin the search for a user account for a specific OU, and it accepts the distinguished name (DN) of the OU.
Example
PS> Get-ADUser -Filter * -SearchBase 'OU=TsinfoUsers,DC=domain,DC=local'Using the Filter of * means it will match all user accounts.
List all Domain Users
You can list down all the domain users using the asterisk as a parameter * along with the Get-AdUser PowerShell cmdlet. The syntax will be like below
Get-ADUser -Filter *Get All Properties
We can also retrieve all the attributes of the Ad user using the below PowerShell command.
PS> Get-ADUser -Filter * -Properties *Get-AdUser with Get-Help
You can get all the Parameter details of the Get-AdUser PowerShell command using the Get-Help command and the Get-AdUser command. The syntax will be like below
Help Get-AdUserGet-AdUser Export To CSV File
Suppose you want to make a report of the list of users in a CSV file. You can use the below PowerShell cmdlet to quickly export the list of users to a CSV file.
PS> Get-ADUser -Filter "*" | Export-CSV -Path TestUsers.csvList Only Enabled Users using Get-AdUser
you can get the list of users with AD user ID enabled or active users using the below PowerShell cmdlet.
PS> Get-ADUser -Filter {Enabled -eq $TrueFinal Thoughts
In this article, we discussed the syntax and usage of the get-aduser PowerShell command with examples of how to use this command. Thanks for reading this article !!!

I am Rajkishore, and I am a Microsoft Certified IT Consultant. I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machines, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.
