Scripts

MFA STATUS (1)

# Install the MSOnline module if this is first use
Install-Module MSOnline
# Add the MSOnline module to the PowerShell session
Import-Module MSOnline
Write-Host “Finding Azure Active Directory Accounts…”
Connect-MsolService
$Users = Get-MsolUser -All | ? { $_.UserType -ne “Guest” }
$Report = [System.Collections.Generic.List[Object]]::new() # Create output file
Write-Host “Processing” $Users.Count “accounts…”
ForEach ($User in $Users) {
$MFAEnforced = $User.StrongAuthenticationRequirements.State
$MFAPhone = $User.StrongAuthenticationUserDetails.PhoneNumber
$DefaultMFAMethod = ($User.StrongAuthenticationMethods | ? { $_.IsDefault -eq “True” }).MethodType
If (($MFAEnforced -eq “Enforced”) -or ($MFAEnforced -eq “Enabled”)) {
Switch ($DefaultMFAMethod) {
“OneWaySMS” { $MethodUsed = “One-way SMS” }
“TwoWayVoiceMobile” { $MethodUsed = “Phone call verification” }
“PhoneAppOTP” { $MethodUsed = “Hardware token or authenticator app” }
“PhoneAppNotification” { $MethodUsed = “Authenticator app” }
}
}
Else {
$MFAEnforced = “Not Enabled”
$MethodUsed = “MFA Not Used”
}
$ReportLine = [PSCustomObject] @{
User = $User.UserPrincipalName
Name = $User.DisplayName
MFAUsed = $MFAEnforced
MFAMethod = $MethodUsed
PhoneNumber = $MFAPhone
}

$Report.Add($ReportLine)
}

Write-Host “Report is in c:\temp\MFAUsers.CSV”
$Report | Select User, Name, MFAUsed, MFAMethod, PhoneNumber | Sort Name | Out-GridView
$Report | Sort Name | Export-CSV -NoTypeInformation -Encoding UTF8 c:\temp\MFAUsers.csv

MFA STATUS (2)

Get All Users

ClientlnboxMailForwarding

Mailbox Delegates And Forwarding

Audit client side rules

Organisation Side Forwarding Rules

Last updated