Powershell Cmdlets that checks MFA Status

%3CLINGO-SUB%20id%3D%22lingo-sub-1656311%22%20slang%3D%22en-US%22%3EPowershell%20Cmdlets%20that%20checks%20MFA%20Status%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1656311%22%20slang%3D%22en-US%22%3E%3CP%3EDoes%20any%20one%20know%20if%20there%20are%20Powershell%20Cmdlet%20that%20checks%20if%20MFA%20is%20disabled%20and%20phone%20number%20is%20registered%20under%20authentication%20methods.%3C%2FP%3E%3CP%3EIf%20both%20conditions%20are%20met%2C%20then%20it%20enables%20or%20enforce%20MFA%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1656311%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMFA%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1656564%22%20slang%3D%22en-US%22%3ERe%3A%20Powershell%20Cmdlets%20that%20checks%20MFA%20Status%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1656564%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F538181%22%20target%3D%22_blank%22%3E%40Khaled_Shyiab%3C%2FA%3E%26nbsp%3BHi%2C%20take%20a%20look%20at%20these.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EReporting%20MFA-Enabled%20Accounts%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Foffice365itpros.com%2F2018%2F11%2F21%2Freporting-mfa-enabled-accounts%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Foffice365itpros.com%2F2018%2F11%2F21%2Freporting-mfa-enabled-accounts%2F%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EExport%20Office%20365%20Users%20MFA%20Status%20to%20CSV%20using%20PowerShell%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fgallery.technet.microsoft.com%2Foffice%2FExport-Office-365-Users-81747c73%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgallery.technet.microsoft.com%2Foffice%2FExport-Office-365-Users-81747c73%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Does any one know if there are Powershell Cmdlet that checks if MFA is disabled and phone number is registered under authentication methods.

If both conditions are met, then it enables or enforce MFA ?

2 Replies

@Khaled_Shyiab Hi, take a look at these.

 

Reporting MFA-Enabled Accounts
https://office365itpros.com/2018/11/21/reporting-mfa-enabled-accounts/ 

 

Export Office 365 Users MFA Status to CSV using PowerShell

https://gallery.technet.microsoft.com/office/Export-Office-365-Users-81747c73 

@Khaled_Shyiab 

something like this should work

 

----- Script -----

Import-Module -Name MSOnline

Connect-MsolService

 

$EligibleUsers  = Get-MsolUser -All | Where-Object -FilterScript {$_.MobilePhone -and -not $_.StrongAuthenticationMethods}   

 

foreach ($User in $EligibleUsers)

{

        $SAM = New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationMethod

        $SAM.IsDefault  = $true

        $SAM.MethodType = "OneWaySMS"

        Set-MsolUser -ObjectID $User.ObjectId -StrongAuthenticationMethods $SAM

 

    Write-Output "Set SMS MFA for user '($($User.UserPrincipalName))' to '$($User.MobilePhone)'"

} 

 

----- Script End -----