{"id":452,"date":"2021-01-01T00:00:00","date_gmt":"2021-01-01T00:00:00","guid":{"rendered":"https:\/\/www.anderson.nl\/?p=452"},"modified":"2021-01-01T00:00:00","modified_gmt":"2021-01-01T00:00:00","slug":"controleer-of-mfa-aanstaat","status":"publish","type":"post","link":"https:\/\/anderson.nl\/?p=452","title":{"rendered":"Controleer of MFA aanstaat"},"content":{"rendered":"\n<p>Met het onderstaande PowerShell script kan je eenvoudig controleren of MFA aanstaat voor je Microsoft 365 omgeving.<br \/><br \/>Start PowerShell als Administrator <strong>Connect-MsolService<\/strong> en meld je aan met het admin account van je Microsoft 365 omgeving.<\/p>\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<pre class=\"wp-block-code\"><code>Write-Host \"Finding Azure Active Directory Accounts...\"\n$Users = Get-MsolUser -All | ? {$_.IsLicensed -eq $True}\n$Report = &#91;System.Collections.Generic.List&#91;Object]]::new() # Create output file\nWrite-Host \"Processing\" $Users.Count \"accounts...\"\nForEach ($User in $Users) {\n   $MFAMethods = $User.StrongAuthenticationMethods.MethodType\n   $MFAEnforced = $User.StrongAuthenticationRequirements.State\n   $DefaultMFAMethod = ($User.StrongAuthenticationMethods | ? {$_.IsDefault -eq \"True\"}).MethodType\n   If (($MFAEnforced -eq \"Enforced\") -or ($MFAEnforced -eq \"Enabled\")) {\n      Switch ($DefaultMFAMethod) {\n        \"OneWaySMS\"             { $MethodUsed = \"One-way SMS\" }\n        \"TwoWayVoiceMobile\"     { $MethodUsed = \"Phone call verification\" }\n        \"PhoneAppOTP\"           { $MethodUsed = \"Hardware token or authenticator app\" }\n        \"PhoneAppNotification\"  { $MethodUsed = \"Authenticator app\" }\n      } #End Switch\n    }\n    Else {\n          $MFAEnforced= \"Not Enabled\"\n          $MethodUsed = \"MFA Not Used\" }\n   $ReportLine = &#91;PSCustomObject] @{\n           User        = $User.UserPrincipalName\n           Name        = $User.DisplayName\n           MFAUsed     = $MFAEnforced\n           MFAMethod   = $MethodUsed }\n    $Report.Add($ReportLine)\n} # End For\nWrite-Host \"Report is in c:\\Beheer\\MFAUsers.CSV\"\n$Report | Select Name, MFAUsed, MFAMethod | Out-GridView\n$Report | Export-CSV -NoTypeInformation c:\\Beheer\\MFAUsers.CSV<\/code><\/pre>\n<\/div><\/div>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Met het onderstaande PowerShell script kan je eenvoudig controleren of MFA aanstaat voor je Microsoft 365 omgeving. Start PowerShell als Administrator Connect-MsolService en meld je aan met het admin account van je Microsoft 365 omgeving.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,8,11,12,13],"tags":[],"class_list":["post-452","post","type-post","status-publish","format-standard","hentry","category-azure","category-intune","category-microsoft-365","category-office-365","category-powershell"],"_links":{"self":[{"href":"https:\/\/anderson.nl\/index.php?rest_route=\/wp\/v2\/posts\/452","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/anderson.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anderson.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anderson.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/anderson.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=452"}],"version-history":[{"count":0,"href":"https:\/\/anderson.nl\/index.php?rest_route=\/wp\/v2\/posts\/452\/revisions"}],"wp:attachment":[{"href":"https:\/\/anderson.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anderson.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anderson.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}