Skip to Content
Microsoft 365Entra IDBlocked Sign-In Users

Blocked Sign-In Users

Lists all users in the tenant and identifies which ones have their sign-in blocked.

Usage

Requires an active Microsoft Graph connection:

Connect-MgGraph -Scopes "User.Read.All"

Script

$allUsers = Get-MgUser -All -Property DisplayName, UserPrincipalName, AccountEnabled $results = @() foreach ($user in $allUsers) { $results += [PSCustomObject]@{ DisplayName = $user.DisplayName UserPrincipalName = $user.UserPrincipalName BlockedSignIn = if ($user.AccountEnabled) { "No" } else { "Yes" } } } # Display results $results | Format-Table -AutoSize # Summary Write-Host "Total Users: $($results.Count)" Write-Host "Users with Blocked Sign-In: $(($results | Where-Object { $_.BlockedSignIn -eq 'Yes' }).Count)"
Last updated on