Get-ADUser PowerShell - Get AD user details using email address


Get-ADUser PowerShell command can be used to get a user or multiple user objects from Active Directory.

Start Windows PowerShell or SharePoint Management Shell (right click - run as administrator) and execute the command.


✔️ Syntax of Get-ADUser PowerShell command

Get-ADUser -Filter [-ResultPageSize ] [-ResultSetSize ] [-SearchBase ] [-SearchScope { | | }] [-SearchScope { | | }] [-AuthType { | }] [-Credential ] [-Partition ] [-Properties ] [-Server ] []


✔️ Get-ADUser PowerShell command to get user profile

Replace the email address with your original email-id before running this command.

Get-ADUser -Filter {Emailaddress -eq 'user@code2care.com'}


✔️ Get selective user properties using Get-ADUser

You can modify the command to get only the desired property. Below example gets only Display Name, this will return only the Name of the user.

Get-ADUser -Filter {Emailaddress -eq 'user@code2care.com'} -Properties Name | Select Name


⛏️ Troubleshooting

If you get an error The term 'Get-ADUser' is not recognized as the name of a cmdlet, run below commands before executing the above script.
Get-ADUser PowerShell command
Get-ADUser PowerShell command
Import-Module ServerManager

Add-WindowsFeature RSAT-AD-PowerShell

import-module activedirectory


Have Questions? Post them here!
Advertisements
Try Out Code2care Dev Tools:

Advertisements



Android Java Linux Microsoft Google Python macOS Notepad++ Microsoft Teams CSS PHP SharePoint Html Linux C Programs Bootstrap jQuery Sublime Android Studio Facebook Eclipse WhatsApp News MySQL Json HowTos JavaScript FTP S3


Advertisements


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and Software Developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include Learnings, Tutorials, Trouble-Shooting steps, Video Tutorials, Code Snippets, How Tos, Blogs, Articles, etc.
🎉 We are celebrating the 10th years of Code2care! Thank you for all your support! We hope we made a difference.
We strong support Gender Equality & Diversity.

We stand in solidarity with Ukraine - Make a donation to UNHCR - https://donate.unhcr.org/in/en-in/ukraine-emergency