ביקורת גישה לתיבות דואר שאינה של הבעלים ב-Exchange Online באמצעות PowerShell
שמירה על שליטה קפדנית בהרשאות תיבות דואר היא קריטית להגנה על מידע רגיש בארגון. גישה של מי שאינו הבעלים לתיבות דואר יכולה להוות סיכון אבטחה אם אינה מנוטרת כראוי.
הסקריפט מסייע למנהלים לזהות מקרים שבהם למי שאינו הבעלים יש גישה לתיבות דואר, ומאפשר סקירה יסודית של הרשאות והבטחה שזכויות הגישה מתיישרות עם מדיניות הארגון.
סקריפט
Section titled “סקריפט”# Connect to Exchange OnlineConnect-ExchangeOnline
# Function to check non-owner access permissionsfunction Check-NonOwnerAccess { # Get all mailboxes $mailboxes = Get-Mailbox -RecipientTypeDetails UserMailbox -ResultSize Unlimited
# Prepare an array to hold the non-owner access information $nonOwnerAccessInfo = @()
foreach ($mailbox in $mailboxes) { $mailboxPermissions = Get-MailboxPermission -Identity $mailbox.Identity
foreach ($permission in $mailboxPermissions) { if ($permission.User -ne $mailbox.Identity -and $permission.User -ne "NT AUTHORITY\SELF" -and $permission.AccessRights -ne "FullAccess") { $nonOwnerAccessInfo += [PSCustomObject]@{ Mailbox = $mailbox.PrimarySmtpAddress NonOwner = $permission.User AccessRights = $permission.AccessRights Deny = $permission.Deny InheritanceType = $permission.InheritanceType } } } }
return $nonOwnerAccessInfo}
# Check the non-owner access permissions$nonOwnerAccessResults = Check-NonOwnerAccess
# Display the non-owner access information$nonOwnerAccessResults | Format-Table -AutoSize
# Optionally export to CSV$nonOwnerAccessResults | Export-Csv -Path "NonOwnerAccessResults.csv" -NoTypeInformation
Write-Output "Non-owner access results exported to NonOwnerAccessResults.csv"
# Disconnect from Exchange OnlineDisconnect-ExchangeOnline -Confirm:$false