Use PowerShell to get the MFA enabled or disabled status of Office 365 and Azure users and type of MFA used

Problem:

I wanted to use PowerShell to get the MFA enabled or disabled status of Office 365 and Azure users and type of MFA used, then output the results to a .csv file.

Solution:

Run the below command to output MFA details and status for all users:

Get-MsolUser -all | select DisplayName,UserPrincipalName,@{N="MFA Status"; E={ if( $_.StrongAuthenticationMethods.IsDefault -eq $true) {($_.StrongAuthenticationMethods | Where IsDefault -eq $True).MethodType} else { "Disabled"}}} | FT -AutoSize

 

Use the below command to output details for one specific user:

Get-MsolUser -UserPrincipalName user.name@domain.com | select DisplayName,UserPrincipalName,@{N="MFA Status"; E={ if( $_.StrongAuthenticationMethods.IsDefault -eq $true) {($_.StrongAuthenticationMethods | Where IsDefault -eq $True).MethodType} else { "Disabled"}}} | FT -AutoSize

10 Replies to “Use PowerShell to get the MFA enabled or disabled status of Office 365 and Azure users and type of MFA used”

  1. your code is cool, unfortunately i can’t get it to work under powershell 7. what do I have to do so that it also runs under powershell 7?

    1. Got the results, But how to export in CSV…….. did u get the answer by now? Hope so. It is alr 3 months. If not post ur code here. I will answer with proven result

  2. Thanks for the script it’s what I need. Is there a way I can filter or only show results for users in a specific OU container ?
    Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *