發表文章

目前顯示的是 9月, 2021的文章

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 :