Entra / Microsoft 365 · Users & guests
Find non-SSPR enabled users
Find Entra ID licensed member accounts that are not capable of self-service password reset (SSPR).
Connect & set up
Run these once per session. All scopes are read-only unless the script makes changes.
Connect-MgGraph -Scope Directory.Read.All, UserAuthenticationMethod.Read.All, AuditLog.Read.All
Run it
The main script. Copy it, or download the .ps1 and run it from your console.
Connect-MgGraph -Scope Directory.Read.All, UserAuthenticationMethod.Read.All, AuditLog.Read.AllSelect-MgProfile BetaWrite-Host "Finding licensed Azure AD accounts"[array]$Users = Get-MgUser -Filter "assignedLicenses/`$count ne 0 and userType eq 'Member'" -ConsistencyLevel eventual -CountVariable Records -All# Populate a hash table with the details about user accounts$UserTable = @{}ForEach ($U in $Users) {$ReportLine = [PSCustomObject] @{Id = $U.IdDisplayName = $U.DisplayNameDepartment = $U.DepartmentOffice = $U.OfficeLocationCountry = $U.Country}$UserTable.Add([String]$U.Id, $ReportLine)}Write-Host "Finding user accounts not capable of Self-Service Password Reset (SSPR)"[array]$SSPRUsers = Get-MgReportAuthenticationMethodUserRegistrationDetail | Where-Object {$_.userType -eq 'member' -and $_.IsSSPRCapable -eq $False} | Select-Object Id, userDisplayName, userPrincipalName, DefaultMfaMethod, IsAdmin, IsMfaCapable, IsMfaRegistered, IsPasswordlessCapable, IsSSPRCapableWrite-Host "Cross-checking against licensed users..."$NonSSPRUsers = [System.Collections.Generic.List[Object]]::new() # Create merged output fileForEach ($S in $SSPRUsers) {$Data = $UserTable.Item($S.Id)If ($Data) { # We found a match$ReportLine = [PSCustomObject] @{Id = $Data.IdDisplayName = $Data.DisplayNameDepartment = $Data.DepartmentOffice = $Data.OfficeCountry = $Data.Country }$NonSSPRUsers.Add($ReportLine) }}$PNonSSPR = ($NonSSPRUsers.count/$Users.Count).toString("P")Write-Host ("{0} out of {1} licensed accounts ({2}) are not enabled for Self-Service Password Reset" -f $NonSSPRUsers.count, $Users.count, $PNonSSPR )Write-Host ($NonSSPRUsers.DisplayName -join ", ")$NonSSPRUsers | Out-GridView
Attribution
Author
Office365itpros