MSP StockroomFind a guide, template or tool…/
Curated SOPs / Microsoft 365 and identity

M365 Curated SOP / Microsoft 365 and identity

Review guest users and when they last signed in

List every guest account in a client's Microsoft 365 tenant, who it belongs to and when it last signed in.

Low risk / Read-only / Reviewed December 2, 2026

Written and maintained by MSP Stockroom. Nobody else edits it.

On this page

Before you run anything: read every command first and understand what it does. Replace example names, domains and addresses with your own. Try it on a test device or tenant before a client's. Keep client names, passwords and keys out of tickets and chat.

Purpose

List every guest account in a client's Microsoft 365 tenant, who it belongs to and when it last signed in. Guests keep their access to Teams, SharePoint and shared files long after a project ends, and anything a guest can open is also something AI tools in the tenant can surface to the people it is shared with. Run it at onboarding, every quarter, and before a Copilot rollout. Read-only: nothing in this SOP changes the tenant.

Scope and prerequisites

  • Run by the client's assigned engineer.
  • Needs an account that can read users and sign-in activity, such as Global Reader plus Reports Reader.
  • Last sign-in dates need Microsoft Entra ID P1 or P2. Without it, run steps 1 to 3 without SignInActivity and judge by creation date only.
  • The Microsoft Graph PowerShell SDK installed from the PowerShell Gallery.
  • Store the results in your documentation platform, never in this library.

Steps

  1. Sign in with read-only scopes:
    # Read-only scopes. You will be asked to sign in to the client's tenant.
    Connect-MgGraph -Scopes "User.Read.All", "AuditLog.Read.All"
  2. List guest accounts with their last successful sign-in:
    $guests = Get-MgUser -All -Property DisplayName, Mail, UserType, AccountEnabled,
            CreatedDateTime, ExternalUserState, SignInActivity |
        Where-Object UserType -eq 'Guest'
    
    $guests | Select-Object DisplayName, Mail, AccountEnabled, ExternalUserState,
        CreatedDateTime,
        @{ n = 'LastSuccessfulSignIn'; e = { $_.SignInActivity.LastSuccessfulSignInDateTime } } |
        Sort-Object LastSuccessfulSignIn
  3. Sort the guests into three groups and record them:
    • Never signed in and created more than 30 days ago, or ExternalUserState PendingAcceptance: the invitation was never used.
    • Last successful sign-in more than 90 days ago: likely finished work.
    • Signed in within 90 days: active. Confirm with the client that each one should still have access.
    $cutoff = (Get-Date).AddDays(-90)
    $guests | Where-Object {
        $last = $_.SignInActivity.LastSuccessfulSignInDateTime
        (-not $last -and $_.CreatedDateTime -lt (Get-Date).AddDays(-30)) -or
        ($last -and $last -lt $cutoff)
    } | Select-Object DisplayName, Mail, CreatedDateTime,
        @{ n = 'LastSuccessfulSignIn'; e = { $_.SignInActivity.LastSuccessfulSignInDateTime } }
  4. Disconnect when finished:
    Disconnect-MgGraph

Verify

The client has a list of guests in three groups, and an owner inside the client has agreed which stale guests can go.

Rollback

Nothing to roll back; this SOP only reads. Blocking or deleting a guest is a separate change, made with the client's approval. Block sign-in first and delete later, so a mistake can be undone.

Notes

Sign-in dates can take up to a day to update, and a blank date can mean the guest never signed in or last signed in before April 2020. For ongoing clean-up, Microsoft Entra ID Governance has an inactive guest report and access reviews. See https://learn.microsoft.com/entra/identity/users/clean-up-stale-guest-accounts for Microsoft's guidance.

Sources and notes

Curated SOP from the MSP Stockroom SOP library (curated/m365-identity/review-guest-users-and-when-they-last-signed-in.md). Last reviewed December 2, 2026. Tested on: Not yet run; written for Microsoft Graph PowerShell SDK 2.x; PowerShell 7.4. Vendor screens and commands change; check the vendor documentation before you rely on a step. Found a mistake? See corrections.

Search the stockroom

↑ ↓ to choose · Enter to open · Esc to close

Open the full search page →