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
Thank you Robin clarke. You can use the below script to generate Office 365 users MFA status report with more attributes like Display Name, User Principal Name, MFA Status, Activation Status, Default MFA Method, All MFA Methods, MFA Phone, MFA Email, License Status, IsAdmin, Admin Roles, SignIn Status, etc.
https://o365reports.com/2019/05/09/export-office-365-users-mfa-status-csv/
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?
Awesome, cheers
Got the results, But how to export in CSV
Got the results, But how to export in CSV
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
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.
Ok, those are great to know the user MFA’s status. Put anyone have a script to change the status?
how to check in application
Thanks for sharing. Since MSOnline module is under deprecation, you can start to utilize the MS Graph PowerShell. I have written a PowerShell scripts to resolve multiple use cases like exporting MFA status for a single user, list of users, all users, status-wise report, etc.
https://m365scripts.com/security/check-mfa-status-for-microsoft-365-users-using-powershell/