Query For User Accounts In Active Directory With PowerShell - Lunavi
Maybe your like
Infrastructure Services
Azure Cloud MigrationMove your infrastructure to Azure with our expertise.
ColocationLeverage our geographically diverse datacenters.
Lunavi Hybrid/Private CloudOur private or hybrid cloud solutions are feature-rich and backed by experts.
Critical Workload ManagementEnsure maximum uptime with our multi-redundant facilities
Managed Services
Azure Managed CloudWant to save on IT costs? Look no further.
Managed BackupEnsure that your data stays safe no matter the incident.
Disaster RecoveryGet business-critical data back fast, and reduce downtime.
Managed SecurityManaged Firewall, Endpoint Protection, Reports and more.
Data & AI Solutions
Data ModernizationUnify your data and gain the competitive edge.
Machine Learning Data Platform Develop a platform that showcases key insights day after day.
AI Predictive Data AnalyticsLeverage AI to identify threats or opportunities before they happen.
Data Discovery AcceleratorGet started with a quick Accelerator leveraging Microsoft Fabric.
AI & App Development
Intelligent App DevelopmentLet our experts develop a next gen AI powered application.
Application Development We've built hundreds of cloud or mobile applications. Let us build yours.
DevOps SolutionsWe help dev teams, leveraging agile best practices, Github copilot and more.
Gen AI App Accelerator Learn how AI can benefit your business with a Proof of Concept in weeks.
IndustriesIndustries
We are HIPAA compliant and ready to help your Healthcare IT needs.
We help Hospitality have better customer experiences through technology.
We help financial orgs with security, compliance, AI breakthroughs and more.
We can help manufacturers save on IT and focus on their business.
ResourcesResources
Get the latest insights from our experts.
Check out our customer success stories.
Featured from Blog
Today, Intelligent Applications and AI Agents are where enterprises can unlock real value, but how do you ensure that your AI stays on track?
Read More >AI policies are repeating 30 years of workplace tech friction—here’s what history reveals about getting governance right.
Read More >See all articles AboutAbout Us
Learn about Lunavi, Our Leadership and more.
What's Next For you? Work with us! Find out more here.
Learn about our partnerships here, login to the partner portal, or sign up to become a partner!
Pursuing the right path for the future.
Support Request a ConsultationQuery for User Accounts in Active Directory with PowerShellMarch 1, 2023
Occasionally there is a need to quickly query Active Directory for all user accounts or user accounts with only certain values in particular properties. This can be done by installing and loading the Microsoft Active Directory Administration module for PowerShell. This is an add-on module, named ActiveDirectory, that provides cmdlets that let you manage your Active Directory domains.
After you install the ActiveDirectory module, there is now a new PowerShell option in Administrative Tools, called Active Directory Module for Windows PowerShell:

This brings up the bland, DOS-like command prompt with the ActiveDirectory module automatically loaded. But what if you like to work in the Windows PowerShell Integrated Scripting Environment (ISE)? Start up ISE and then run the following command:
Import-module ActiveDirectory
That will load the ActiveDirectory module into your ISE session, so that you can use the desired cmdlets.
Querying for User Accounts
To query for user accounts, use the Get-ADUser cmdlet. For example, here is how you would query against your domain for all user accounts:
Get-ADUser -Filter * -SearchBase "DC=ad,DC=company,DC=com"
If you wanted to query for all of the user accounts with the last name "Collicott", you would run the following:
Get-ADUser -Filter {Surname -eq "Collicott"} -SearchBase "DC=ad,DC=company,DC=com"
To export the e-mail addresses for all user accounts to a CSV file, you could run the following:
Get-ADUser -Filter * -SearchBase "DC=ad,DC=company,DC=com" -Properties mail | Select mail | Export-CSV "Email Addresses.csv"
You can also find additional examples by viewing the help on the cmdlet:
Get-Help Get-ADUser -examples
Related Topics:
DevOpsMicrosoftPrevious post
Quarterly Wrap Up: Top Data Center News
Next post
Quickly Adding Meeting Details to OneNote
Join our newsletter
We're always talking about what's next in technology. Thank you! Your submission has been received!Oops! Something went wrong while submitting the form..png)
We're here to help you tackle what's next in your digital journey.
SolutionsIndustriesContact UsCase StudiesBlogAbout usPartnershipsCareersFollow Us:Tag » Active Directory Search User Powershell
-
Get-ADUser (ActiveDirectory) - Microsoft Docs
-
Get-AdUser: Finding Active Directory Users With PowerShell
-
Get-ADUser: Find Active Directory User Info With PowerShell
-
Get-ADUser - How To Find And Export AD Users With PowerShell
-
Using PowerShell To Search For Specific Users In Active Directory ...
-
Active Directory Queries With PowerShell - ScriptRunner
-
Searching Active Directory With PowerShell - Ipswitch
-
Get-AdUser - Get Active Directory Users Using PowerShell - ShellGeek
-
Query Active Directory Users In PowerShell | Delft Stack
-
Get-AdUser: How To Audit Active Directory Users With PowerShell
-
Get A List Of AD Users Having A Specific CN - ManageEngine
-
How To Get A List Of Disabled Users In AD With Or Without PowerShell
-
How To Find Inactive Users In Active Directory Using PowerShell
-
User Management Via Get-ADUser Powershell Cmdlet - Imanami