added ExchangeOnline directory and tenant mailbox rule export script
This commit is contained in:
parent
a7fcad8708
commit
b3218f82a3
@ -0,0 +1,30 @@
|
|||||||
|
# Script will connect to ExchangeOnline, gather all user inbox rules across the tenant and export to a CSV file locally.
|
||||||
|
# Internal forwarding will appear as "Display Name" and include MailOwnerId in rule
|
||||||
|
# External forwarding will appear as "email@domain.com" [SMTP:email@domain.com]
|
||||||
|
|
||||||
|
# Create export path
|
||||||
|
$exportPath = "C:\temp\exports\UserMailboxRulesExport.csv"
|
||||||
|
|
||||||
|
# Prepare file (optional: overwrite each time script runs)
|
||||||
|
if (Test-Path $exportPath) { Remove-Item $exportPath }
|
||||||
|
|
||||||
|
# Get all mailboxes
|
||||||
|
$users = Get-Mailbox -ResultSize Unlimited
|
||||||
|
|
||||||
|
foreach ($user in $users) {
|
||||||
|
$rules = Get-InboxRule -Mailbox $user.UserPrincipalName | Select-Object `
|
||||||
|
@{Name='DisplayName'; Expression={$user.DisplayName}},
|
||||||
|
@{Name='EmailAddress'; Expression={$user.PrimarySmtpAddress}},
|
||||||
|
MailboxOwnerID,
|
||||||
|
Name,
|
||||||
|
Description,
|
||||||
|
Enabled,
|
||||||
|
RedirectTo,
|
||||||
|
MoveToFolder,
|
||||||
|
ForwardTo
|
||||||
|
|
||||||
|
# Export rules if any exist
|
||||||
|
if ($rules) {
|
||||||
|
$rules | Export-Csv $exportPath -NoTypeInformation -Append
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user