How to List Active Directory Users with PowerShell

发布时间:2025-08-29 07:45

学习当地常用口语可以快速融入当地文化,如问路:'Excuse me, how can I get to...?' #生活知识# #旅游生活# #旅游语言学习#

In this article, I’ll show you how to list Active Directory users with PowerShell. While you can also list Active Directory (AD) users in Active Directory Users and Computers, PowerShell provides a much faster way.

Check out how to list Active Directory Users with ADUC on Petri if you would prefer to perform this action using a GUI tool.

Let’s look at the main method to list Active Directory users – PowerShell, or, more accurately, the Active Directory Module for Windows PowerShell. Check out this article on Petri if you need to install the Active Directory Module for PowerShell.

In Administrative Tools, we have the Active Directory Module for Windows PowerShell In Administrative Tools, we have the Active Directory Module for Windows PowerShell (Image Credit: Petri.com/Michael Reinders)

Finding all Active Directory users with the PowerShell Get-AdUser cmdlet

First off, let’s try listing Active Directory users with PowerShell, and format them in table format with the Get-AdUser command

Get-ADUser -filter * | ft

List Active Directory users with PowerShell List Active Directory users with PowerShell (Image Credit: Petri.com/Michael Reinders)

We used the ‘-filter‘ command and chose ‘*’ for all. Then, we ‘piped’ | the output to Format-Table (ft) format.

Filtering results with PowerShell

Now, let’s filter for all the wonderful people in the Reinders clan. We only need the Name and SamAccountName for each, so we’ll add attributes at the end, meaning we ONLY want to see those items.

Get-ADUser -Filter 'Name -like "*Reinders*"' | ft Name,SamAccountName

The Reinders Family...in Active Directory The Reinders Family…in Active Directory (Image Credit: Petri.com/Michael Reinders)

Piece of cake. Let’s get a list of all disabled accounts. We’ll use the following command:

Get-ADUser -Filter {(Enabled -eq $False)} | ft Name,SamAccountName

List all disabled Active Directory users with PowerShell List all disabled Active Directory users with PowerShell (Image Credit: Petri.com/Michael Reinders)

Checking attributes for user accounts in Active Directory

In case you’re unaware, there are dozens of attributes in each user account. Let’s get a glimmer of those for Billy Reinders with another variation.

Get-ADUser -Identity breinders -Properties *

All (mostly) the attributes for Billy Reinders All (mostly) the attributes for Billy Reinders (Image Credit: Petri.com/Michael Reinders)

That is about half of them. One nice thing you can do when desiring specific output is to use wildcard characters for what attributes you want.

How about any attribute to do with ‘name’?

Get-ADUser -Identity breinders -Properties *Name*

This outputs the core attributes and the ones with 'Name' in them This outputs the core attributes and the ones with ‘Name’ in them (Image Credit: Petri.com/Michael Reinders)

Conclusion

Listing Active Directory users with PowerShell and the Get-ADUser cmdlet is easy. As you have seen, you can apply various filters to get the results you want or simply get a complete list of users.

网址:How to List Active Directory Users with PowerShell https://klqsh.com/news/view/196628

相关内容

How to Get Help with File Explorer in Windows 11/10
Get Help With File Explorer in Windows 11 & 10 (Ultimate Guide)
How to Install a VPN on Kindle Fire
How To See All Bing Related Searches
Get Help with File Explorer in Windows 11
How To Get Help In Windows 11 (All Methods)
How to Use Copilot to Transcribe Meetings
Full List of Colleges with the largest endowment in 2024
How to Make Your Windows Computer Aesthetic
Starter query samples

随便看看