Compare commits

...

3 Commits

Author SHA1 Message Date
IxianPixel 38a31f1f62 Updated MFA Report to include default MFA method 2024-11-28 17:53:11 +00:00
IxianPixel 74a83e7444 Added Get-MFAReport 2024-09-03 17:25:22 +01:00
IxianPixel d118b574a9 Removing SharingPermissionsFlag 2024-09-03 13:02:39 +01:00
4 changed files with 58 additions and 1 deletions
Vendored
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -18,5 +18,5 @@ foreach ($mailbox in $mailboxes) {
$processCount++
$percentComplete = (($processCount / $totalMailboxes) * 100)
Write-Progress -Activity "Applying calendar permissions" -Status "Processing $calendarPath" -PercentComplete $percentComplete
Add-MailboxFolderPermission -Identity $calendarPath -User $upn -AccessRights $calendarPermission -SharingPermissionFlags Delegate
Set-MailboxFolderPermission -Identity $calendarPath -User $upn -AccessRights $calendarPermission -SharingPermissionFlags None
}
+57
View File
@@ -0,0 +1,57 @@
# Import the Microsoft Graph module
Import-Module Microsoft.Graph
# Connect to Microsoft Graph
Connect-MgGraph -Scopes "User.Read.All", "UserAuthenticationMethod.Read.All"
# Get all users
$users = Get-MgUser -All -Property Id, UserPrincipalName, DisplayName, AccountEnabled
$totalUsers = $users.Count
$processCount = 0
# Initialize an array to store user information
$userInfo = @()
Write-Progress -Activity "Getting User Details" -Status "Starting" -PercentComplete 0
foreach ($user in $users) {
$processCount++
$percentComplete = (($processCount / $totalUsers) * 100)
Write-Progress -Activity "Getting User Details" -Status "Processing $processCount/$totalUsers - $($user.UserPrincipalName)" -PercentComplete $percentComplete
# Get MFA methods for the user
$mfaMethods = Get-MgUserAuthenticationMethod -UserId $user.Id
# Check if any MFA method is registered
$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
$licenses = Get-MgUserLicenseDetail -UserId $user.Id
# Create a custom object for each user
$userObject = [PSCustomObject]@{
UserPrincipalName = $user.UserPrincipalName
DisplayName = $user.DisplayName
AccountEnabled = $user.AccountEnabled
MFARegistered = $mfaRegistered
DefaultMFAMethod = $currentDefaults.userPreferredMethodForSecondaryAuthentication
AuthenticationMethods = ($mfaMethods.AdditionalProperties.'@odata.type' -join ', ').Replace('#microsoft.graph.', '')
Licenses = ($licenses.SkuPartNumber -join ', ')
}
# Add the user object to the array
$userInfo += $userObject
}
# Export the results to a CSV file
$userInfo | Export-Csv -Path "EntraIDUsersMFAReport.csv" -NoTypeInformation
# Disconnect from Microsoft Graph
Disconnect-MgGraph
Write-Host "Report generated: EntraIDUsersMFAReport.csv"
BIN
View File
Binary file not shown.