Hi @JYLVEN TARRAJA ,
Here is a PowerShell script that you can use to generate a report of mailbox names, inbox rules, forwarding addresses, and rule status in Exchange Online:
# Connect to Exchange Online
$UserCredential = Get-Credential
Connect-ExchangeOnline -UserPrincipalName $UserCredential.UserName -Password $UserCredential.GetNetworkCredential().Password
# Get all mailboxes
$mailboxes = Get-Mailbox -ResultSize Unlimited
# Initialize an array to store report data
$report = @()
foreach ($mailbox in $mailboxes) {
# Get the inbox rules for each mailbox
$rules = Get-InboxRule -Mailbox $mailbox.PrimarySmtpAddress
foreach ($rule in $rules) {
# Create a custom object for each rule
$ruleDetails = [PSCustomObject]@{
MailboxName = $mailbox.DisplayName
RuleName = $rule.Name
ForwardTo = ($rule.ForwardTo | ForEach-Object { $_.PrimarySmtpAddress }) -join ", "
RedirectTo = ($rule.RedirectTo | ForEach-Object { $_.PrimarySmtpAddress }) -join ", "
ForwardAsAttachmentTo = ($rule.ForwardAsAttachmentTo | ForEach-Object { $_.PrimarySmtpAddress }) -join ", "
RuleStatus = $rule.Enabled
}
# Add rule details to report array
$report += $ruleDetails
}
}
# Export report to CSV file
$report | Export-Csv -Path "C:\InboxRulesReport.csv" -NoTypeInformation
# Disconnect from Exchange Online
Disconnect-ExchangeOnline -Confirm:$false
This script will:
- Connect to Exchange Online.
- Retrieve all mailboxes.
- For each mailbox, get the Inbox rules and their details.
- Create a custom object for each rule that contains the required information.
- Export the report to a CSV file named InboxRulesReport.csv.
Make sure you run this script in a PowerShell session that has the necessary permissions and the Exchange Online module installed.
Please feel free to contact me for any updates. And if this helps, don't forget to mark it as an answer.
Best,
Jake Zhang