PowerShell Genie

Get-ADUser

Use Get-ADUser to retrieve user accounts from Active Directory by identity, filter or LDAP query.

Command 2 min read Windows PowerShell 5.1 and PowerShell 7

Documentation: Microsoft Learn — get-aduser

Syntax

1PS> Get-ADUser [-Identity] <ADUser> [-Properties <String[]>] [-Server <String>] [-Credential <PSCredential>] [<CommonParameters>]
2PS> Get-ADUser -Filter <String> [-SearchBase <String>] [-Properties <String[]>] [<CommonParameters>]
3PS> Get-ADUser -LDAPFilter <String> [-SearchBase <String>] [-Properties <String[]>] [<CommonParameters>]
See the command anatomy

Read the command and its supplied arguments. This example requires real PowerShell or its module; this diagram does not execute it.

Get-ADUser [-Identity] <ADUser> [-Properties <String[]>] [-Server <String>] [-Credential <PSCredential>] [<CommonParameters>]
  1. Stage 1Get-ADUser-Identity -Properties -Server -Credential

    Try it

    Windows PowerShell

    Browser simulation · fictional data; no changes to your computer.

    Interactive simulation · fictional data

    Examples

    Get-ADUser -Identity jsmith

    1PS> Get-ADUser -Identity jsmith -Properties Department, Manager, LastLogonDate
    Show reference output

    Illustrative output · values vary by environment

    Name        SamAccountName  Enabled
    ----------  --------------  -------
    Jane Smith  jsmith          True

    Get-ADUser -Filter 'Enabled -eq $false'

    1PS> Get-ADUser -Filter 'Enabled -eq $false' -Properties LastLogonDate | Select-Object Name, LastLogonDate
    Show reference output

    Illustrative output · values vary by environment

    Name             LastLogonDate
    ---------------- --------------------
    Temp Contractor  9/10/2026 8:42:14 AM
    Old Service      9/10/2026 9:03:51 AM

    Get-ADUser -Filter *

    1PS> Get-ADUser -Filter * -SearchBase "OU=Sales,DC=corp,DC=local" | Measure-Object
    Show reference output

    Illustrative output · values vary by environment

    Count    : 2
    Average  :
    Sum      :
    Maximum  :
    Minimum  :
    Property :

    Parameters

    Parameter definitions:

    • -Identity
    • -Properties
    • -Server
    • -Credential

    Microsoft Learn — get-aduser

    Query AD users without retrieving everything

    Use -Identity for one known account and -Filter or -LDAPFilter for a directory search. -Properties requests attributes beyond the default property set; ask for the attributes your report actually needs.

    Scope the query

    Limit a search with -SearchBase when only one OU matters. Use -Server when you must query a particular directory server. Filtering at the directory is usually preferable to downloading every user and filtering afterward.

    Interpret the result

    LastLogonDate is a convenient date representation of a replicated logon timestamp, not a precise latest-authentication audit. Do not use it alone to prove that an account was never used recently.

    The ActiveDirectory tools and suitable directory access are prerequisites. An empty scoped search can mean no match; an exception should be investigated separately. These examples do not modify accounts.

    Inspect directory groups

    Updated 1 October 2026. Browser outputs are fictional; check the installed module help for your environment.

    Put this command to work

    Read domain users

    Import ActiveDirectory first. Return all fictional AD user records.

    Review the lesson

    Recap

    Get-ADUser Use Get-ADUser to retrieve user accounts from Active Directory by identity, filter or LDAP query.

    Next: New-ADUser
    Genie guideGet-ADUser

    Use Get-ADUser to retrieve user accounts from Active Directory by identity, filter or LDAP query. The console below is pre-loaded — run it, then change a value and run it again.