Compare commits
1 Commits
74a83e7444
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 38a31f1f62 |
+13
-8
@@ -24,19 +24,24 @@ foreach ($user in $users) {
|
|||||||
$mfaMethods = Get-MgUserAuthenticationMethod -UserId $user.Id
|
$mfaMethods = Get-MgUserAuthenticationMethod -UserId $user.Id
|
||||||
|
|
||||||
# Check if any MFA method is registered
|
# Check if any MFA method is registered
|
||||||
$mfaRegistered = $mfaMethods.Count -gt 0
|
$mfaRegistered = $mfaMethods.Count -gt 1
|
||||||
|
|
||||||
|
# Check the preferred MFA method
|
||||||
|
$uri = "https://graph.microsoft.com/beta/users/$($user.Id)/authentication/signInPreferences"
|
||||||
|
$currentDefaults = Invoke-MgGraphRequest -Uri $uri -Method GET -OutputType PSObject
|
||||||
|
|
||||||
# Get user licenses
|
# Get user licenses
|
||||||
$licenses = Get-MgUserLicenseDetail -UserId $user.Id
|
$licenses = Get-MgUserLicenseDetail -UserId $user.Id
|
||||||
|
|
||||||
# Create a custom object for each user
|
# Create a custom object for each user
|
||||||
$userObject = [PSCustomObject]@{
|
$userObject = [PSCustomObject]@{
|
||||||
UserPrincipalName = $user.UserPrincipalName
|
UserPrincipalName = $user.UserPrincipalName
|
||||||
DisplayName = $user.DisplayName
|
DisplayName = $user.DisplayName
|
||||||
AccountEnabled = $user.AccountEnabled
|
AccountEnabled = $user.AccountEnabled
|
||||||
MFARegistered = $mfaRegistered
|
MFARegistered = $mfaRegistered
|
||||||
MFAMethods = ($mfaMethods.AdditionalProperties.'@odata.type' -join ', ').Replace('#microsoft.graph.', '')
|
DefaultMFAMethod = $currentDefaults.userPreferredMethodForSecondaryAuthentication
|
||||||
Licenses = ($licenses.SkuPartNumber -join ', ')
|
AuthenticationMethods = ($mfaMethods.AdditionalProperties.'@odata.type' -join ', ').Replace('#microsoft.graph.', '')
|
||||||
|
Licenses = ($licenses.SkuPartNumber -join ', ')
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add the user object to the array
|
# Add the user object to the array
|
||||||
@@ -49,4 +54,4 @@ $userInfo | Export-Csv -Path "EntraIDUsersMFAReport.csv" -NoTypeInformation
|
|||||||
# Disconnect from Microsoft Graph
|
# Disconnect from Microsoft Graph
|
||||||
Disconnect-MgGraph
|
Disconnect-MgGraph
|
||||||
|
|
||||||
Write-Host "Report generated: EntraIDUsersMFAReport.csv"
|
Write-Host "Report generated: EntraIDUsersMFAReport.csv"
|
||||||
|
|||||||
Vendored
BIN
Binary file not shown.
Reference in New Issue
Block a user