Inactive user accounts are easy to overlook in Microsoft 365. Over time, these accounts can create unnecessary licensing costs and potential security risks, especially when they remain enabled with permissions or licenses that are no longer needed. For Microsoft 365 administrators, regularly identifying inactive accounts is an important part of maintaining a secure and well-managed environment. But how do you find users who haven’t signed in for 30, 90, or 180 days? There are several ways to approach this. In this guide, we’ll explore the efficient methods to find the last logon time of users in Microsoft 365.
View Recent Sign-In Activity Using Microsoft Entra Admin Center
The Microsoft Entra admin center provides built-in sign-in activity information that administrators can use to identify accounts that are no longer actively used.
- Sign in to the Microsoft Entra admin center.
- Navigate to Entra ID → Users → All users.
- Select the user account you want to investigate.
- Under the user’s overview, locate the Sign–ins information to review recent activity.
- Select See all sign-ins to examine the detailed sign-in records and their status.
For a small number of accounts, the native portal may be sufficient. However, administrators managing hundreds or thousands of users may need a more flexible reporting method.
Check the Last Login Date of Users Using PowerShell
Microsoft Graph PowerShell provides a way to retrieve sign-in activity across the tenant and calculate how long each user has been inactive. This is particularly useful when administrators need custom reports, CSV exports, or recurring auditing scripts.
The following script retrieves users and calculates the number of days since their last successful sign-in.
# 1. Install the Microsoft Graph SDK module if you haven't already
Install-Module Microsoft.Graph -Scope CurrentUser -Force
# 2. Connect ensuring you request the advanced audit log permissions
Connect-MgGraph -Scopes "AuditLog.Read.All", "User.Read.All"
# 3. Define the destination path for your exported CSV file
$ExportPath = "$HOME\Desktop\M365_User_Inactivity_Report.csv"
Write-Host "Fetching user directory and sign-in telemetry from Microsoft Graph..." -ForegroundColor Cyan
# 4. Extract the complete user directory dataset alongside the core signInActivity structures
$AllUsers = Get-MgUser -All -Property "displayName", "userPrincipalName", "signInActivity", "accountEnabled", "mail"
Write-Host "Processing data and calculating absolute inactivity durations..." -ForegroundColor Cyan
# 5. Formulate the dataset array with a calculated continuous inactivity day counter
$ReportData = $AllUsers | Select-Object `
DisplayName,
UserPrincipalName,
Mail,
AccountEnabled,
@{N="LastSignInDateTime"; E={$_.SignInActivity.LastSignInDateTime}},
@{N="ExactDaysInactive"; E={
if ($_.SignInActivity.LastSignInDateTime) {
# Subtracts the last sign-in timestamp from the current system date
((Get-Date) - [DateTime]$_.SignInActivity.LastSignInDateTime).Days
} else {
"Never Logged In"
}
}}
# 6. Export the finalized array to a CSV file (compatible with Excel)
$ReportData | Export-Csv -Path $ExportPath -NoTypeInformation -Encoding UTF8
Write-Host "Success! The inactivity report has been exported to: $ExportPath" -ForegroundColor Green
What the Exported CSV Includes
The exported report looks like below and includes the following information.
- DisplayName & UserPrincipalName: Essential identifier fields for account management.
- AccountEnabled: Quickly tells you if the inactive account is currently active (True) or already blocked (False).
- LastSignInDateTime: The exact timestamp of the user’s last interactive or non-interactive authentication attempt.
- ExactDaysInactive: The exact live counter showing how many days the account has been idle (e.g., 14, 89, 179, or “Never Logged In”).
While Microsoft Graph PowerShell offers flexibility, it requires scripting knowledge, appropriate permissions, and occasional maintenance. Generating reports for large tenants can also take time, and missing sign-in data needs careful interpretation. For administrators who simply want to identify inactive accounts, this approach may be more complex than necessary.
Check Bulk Users’ Last Logon Time Without PowerShell Using EasyEntra
What if you could identify inactive users directly from your user list without writing scripts or checking accounts individually?
EasyEntra makes this possible through its Full Loading Mode, which allows administrators to work with directory information using customizable columns, sorting, and dynamic filtering. Instead of preparing a script for every reporting requirement, administrators can add the information they need and filter the results directly in the interface.
Add the LastActivity Column in EasyEntra
- Open EasyEntra and navigate to the Users view.
- Left-click any column header, such as Display Name, to open the column options dropdown menu.
- From the dropdown, select the LastActivity column to add it to the user list.
- Switch from Incremental Standard Mode to Full Loading Mode.
You can now view each user’s last recorded activity alongside their other account details.
Find Inactive Accounts for the Last 30, 90, or 180 Days
One of the useful features of EasyEntra is its ability to filter directory information using simple search expressions.
For example, to find accounts with a LastActivity date earlier than January 1, 2026, enter: lastactivity<2026-01-01
You can also use the shorter expression: las<2026-01-01
Both expressions allow you to narrow the results without writing a PowerShell query. To identify accounts inactive for 30, 90, or 180 days, simply change the date in the filter to the corresponding cutoff. Unlike a static report, the results update as you adjust your search criteria.
Combine Multiple Filters
Inactivity alone may not provide enough information to decide which accounts require attention. For example, administrators may want to identify inactive accounts belonging to a particular department or review users with specific license assignments.
EasyEntra supports combining search conditions across available columns.
For example, las<30 Department=Sales narrows the results to Sales users whose LastActivity value falls before the specified days.
Export the Inactive User Report
After filtering the user list, you can export the results for review or documentation. EasyEntra provides two convenient options:
- Copy and paste: Select the required rows and use Ctrl+C and Ctrl+V to transfer the information into another application.
- Export: Use the built-in Export option to save the filtered directory information for further analysis.
Establishing a regular 30, 90, or 180 day review process can help administrators identify unnecessary accounts, reduce licensing waste, and maintain better visibility into their Microsoft 365 environment.