Skip to content

Commit 410bdf0

Browse files
authored
Create Get-MFAReport.ps1
0 parents  commit 410bdf0

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Get-MFAReport.ps1

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# You can specify the output file in the OutFile Parameter
2+
param([string]$OutFile)
3+
4+
# If no output file is specified it will be saved to the current user's desktop
5+
if(!($OutFile)){ $outFile = "{0}\Desktop\MFAReport.csv" -f $env:USERPROFILE }
6+
7+
# Get credentials to connecto to M365. (You may get an additional pormpt depending on your modern authentication configuration)
8+
$cred = get-credential
9+
10+
# Connect to the MSOLService
11+
Connect-MsolService -Credential $cred
12+
13+
# Get all users with their MFA Methods
14+
$users = Get-MsolUser -All | SELECT UserPrincipalName, Department, Title, MobilePhone,
15+
@{N='MFA Status';E={($_.StrongAuthenticationMethods.methodtype -contains "PhoneAppNotification" -or $_.StrongAuthenticationMethods -contains "PhoneAppOTP")}},
16+
@{N='PhoneAppNotification';E={$_.StrongAuthenticationMethods.methodtype -contains "PhoneAppNotification"}},
17+
@{N='PhoneAppOTP';E={$_.StrongAuthenticationMethods.methodtype -contains "PhoneAppOTP"}},
18+
@{N='TwoWayVoiceMobile';E={$_.StrongAuthenticationMethods.methodtype -contains "TwoWayVoiceMobile"}},
19+
@{N='OneWaySMS';E={$_.StrongAuthenticationMethods.methodtype -contains "OneWaySMS"}}
20+
21+
$users | ft -AutoSize
22+
$users | Export-Csv -Path $OutFile -NoTypeInformation

0 commit comments

Comments
 (0)