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 :

留言

這個網誌中的熱門文章

Office 2021 離線安裝封裝與KMS啟動步驟

Ollama使用心得與模型導入教學

ARC下NSMutableDictionary 無法使用retainCount