PowerShell for AD user reports

PowerShell for AD user reports

Real-time insights on user account status and activity can help AD  administrators manage accounts better. Many administrators use Microsoft's PowerShell scripts to generate Active Directory reports  and pull detailed information. Below are some key Active Directory PowerShell scripts and commands for generating AD user reports. 

All users reports

Get-ADUser -Filter * -Properties * | Export-csv -path "c:\testexport.csv

Disabled users report

Get-ADUser -Filter 'enabled -eq $False'| fl name,samaccountname,surname,userprincipalname

O365 All users report

Import-module msonline
# Supply the Office365 domain credentials
$username = "testuser@test.onmicrosoft.com"
$password = ConvertTo-SecureString -String "test@123" -AsPlainText -Force
$cred = New-object -typename
System.Management.Automation.PSCredential-argumentlist $username, $password
Connect-MsolService -credential $cred
Get-msoluser

O365 licensed users report

Get-ADUser -Filter * -Properties * | Export-csv -path "c:\testexport.csv

OU specific reports

Get-ADOrganizationalUnit -Filter * | fl name,DistinguishedName

Account status reports

Get-ADUser -Filter * | fl name,enabled

PowerShell searching

Get-ADUser -Filter 'SearchQuery', For example "Get-ADUser -Filter 'enabled -eq $


    • Related Articles

    • Generate an Activity Report for Microsoft 365 Groups and Teams

      Introduction The activity reports available for Microsoft 365 groups and Teams can be beneficial for administrators in an organization. Microsoft 365 teams group activity reports provide insight into group activities, group workloads, group counts, ...
    • PowerShell for AD group reports

      Real-time insights on group membership, type, and scope can help Active Directory (AD) administrators manage group objects better. Many administrators use Microsoft's PowerShell technology to run basic queries and pull detailed information. Below are ...
    • How to find unused Exchange Online mailboxes

      What are unused Exchange Online mailboxes and how to identify them? Unused Exchange Online mailboxes are user mailboxes which are currently not being used by their users. There are 3 ways in which we can identify if a mailbox is unused or not. They ...
    • PowerShell as an AD user management tool

      User management can be quite a challenge for Active Directory (AD) administrators day in and day out. Many administrators use Microsoft's PowerShell technology to perform basic AD user management tasks. Below are some key PowerShell scripts and ...
    • PowerShell as an AD bulk user management tool

      Bulk AD user creation can be quite a challenge for Active Directory (AD) administrators day in, day out. Many administrators use Microsoft's PowerShell to create users and perform other such basic AD user management tasks. Below are some key ...