Office-365-report-that-shows-MFA-status

Connect-MsolService $Users = Get-MsolUser -All | ? { $.UserType -ne "Guest" } $Report = [System.Collections.Generic.List[Object]]::new() # Create output file Write-Host "Processing" $Users.Count "accounts..." ForEach ($User in $Users) { $MFAMethods = $User.StrongAuthenticationMethods.MethodType $MFAEnforced = $User.StrongAuthenticationRequirements.State $MFAPhone = $User.StrongAuthenticationUserDetails.PhoneNumber $DefaultMFAMethod = ($User.StrongAuthenticationMethods | ? { $.IsDefault -eq "True" }).MethodType If (($MFAEnforced -eq "Enforced") -or ($MFAEnforced -eq "Enabled")) { Switch ($DefaultMFAMethod) { "OneWaySMS" { $MethodUsed = "One-way SMS" } "TwoWayVoiceMobile" { $MethodUsed = "Phone call verification" } "PhoneAppOTP" { $MethodUsed = "Hardware token or authenticator app" } "PhoneAppNotification" { $MethodUsed = "Authenticator app" } } } Else { $MFAEnforced = "Not Enabled" $MethodUsed = "MFA Not Used" }

$ReportLine = [PSCustomObject] @{
    User        = $User.UserPrincipalName
    Name        = $User.DisplayName
    MFAUsed     = $MFAEnforced
    MFAMethod   = $MethodUsed 
    PhoneNumber = $MFAPhone
}
             
$Report.Add($ReportLine) 

}

$Report | Sort Name | Export-CSV -NoTypeInformation c:\MFAUsers.csv Before that make sure that you have ms modules installed

Powershell Install-Module MSOnline Install-Module AzureAD Import-Module AzureAD