EASYENTRA Blog

News & Updates

How to Find Last Sign in Activity for Microsoft 365 Users

How to Find Last Sign in Activity for Microsoft 365 Users

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.

  1. Sign in to the Microsoft Entra admin center.
  2. Navigate to Entra ID → Users → All users.
  3. Select the user account you want to investigate.
  4. Under the user’s overview, locate the Sign–ins information to review recent activity.
  5. 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

  1. Open EasyEntra and navigate to the Users view.
  2. Left-click any column header, such as Display Name, to open the column options dropdown menu.
  3. From the dropdown, select the LastActivity column to add it to the user list.
  4. 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.

Free 30-minute demo

try 30 days for free

GET EASYENTRA NEWS

Opt out at any time

“One of the best products I've used.”
Gary Shurland
Chief Information Officer, Mirick, United States
“This tool has been invaluable in streamlining our IT processes.”
Tyson Mckay
Chief Information Officer, Southwest Network, United States
“EasyEntra includes offboarding steps we’d never even thought of, like removing inbox rules.”
Jerry Jacobson
IT Operations Manager, MetalTek International, United States
“This product has been a miracle for our Help Desk. EasyEntra has completely transformed how we handle Microsoft 365 administration.”
Doug Sanders
Manager of Technical Customer Support, Junior Achievement USA, United States
“Your product is such a time saver. I love it!”
Scott Fehr
IT Infrastructure, MEC Aerial Work Platforms, United States
“It's a good product and saves us lots of time for these ongoing quick admin tasks.” 
Chris McFerran
Managing Director, CTech IT Solutions Ltd, United Kingdom
“The speed of creating a user is magic.” 
John Duncan
IT Administrator, MetalTek International, United States
“EasyEntra has significantly streamlined our workflow, simplifying everything. It feels almost like a revolution.”
Johan Sadelius
IT-chef, Arjeplog Kommun, Sweden
I greatly appreciate your assistance and willingness to enhance the already outstanding product.”
Michael I. Wilson
Executive Director of Information Technology, Archdiocese Of Washington, United States
“It's great not having to switch back and forth between the O365 admin center and the Teams admin center to assign groups. I am sold!”
Thomas Madden
Director Information Technology, AutoPayPlus, United States
“I would highly recommend organizations use the solution as it greatly simplifies various tasks.”
S. Roger Singh
Chief Technology Officer, Prasad & Company LLP, Canada
“EasyEntra is time-saving. Love the copy/paste for user/computer groups and the copy to new user.”
Damian Nita
Associate Network Administrator, Shenandoah Valley Westminster-Canterbury, United States
“EasyEntra has transformed our daily IT operations by simplifying user management, reducing errors, and enhancing overall efficiency.”
Henrik Nefling
IT- and Digitalization Manager, Animal Protection Denmark, Denmark