M365查使用者是否啟用MFA POWERSHELL
查詢使用者是否啟用MFA
請把UserPrincipalName換成你想查的帳號
Install-Module -Name AzureAD
Install-Module MSOnline
Connect-MsolService
$Result=@()
$users = Get-MsolUser -UserPrincipalName “AdeleV@M365x068819.OnMicrosoft.com”
$users | ForEach-Object {
$user = $_
$mfaStatus = $_.StrongAuthenticationRequirements.State
if ($mfaStatus -ne $null -or $methodTypes -ne $null)
{if($mfaStatus -eq $null)
{ $mfaStatus='Enabled (Conditional Access)'}}
Else
{$mfaStatus = "Disabled"}
$Result += New-Object PSObject -property @{
UserName = $user.DisplayName
UserPrincipalName = $user.UserPrincipalName
MFAStatus = $mfaStatus
}
}
$Result
footer
See also :

留言