-
Notifications
You must be signed in to change notification settings - Fork 239
Report email forwards
directorcia edited this page Jan 1, 2025
·
1 revision
This PowerShell script checks which email mailboxes in an Exchange Online environment have forwarding options set.
- Includes a disclaimer, description, source URL, and prerequisites.
- Assumes the user is already connected to Exchange Online.
- Initializes message color variables:
$systemmessagecolor
$processmessagecolor
$errormessagecolor
$warnmessagecolor
- Clears the host screen using
Clear-Host
.
- Displays a message indicating the script has started.
- Prints a message indicating the retrieval of all mailbox details is starting.
- Retrieves all mailboxes using the command:
Stores the result in the
Get-Mailbox -ResultSize Unlimited
$mailboxes
variable. - Prints a message indicating mailbox retrieval is complete.
- Prints a message indicating it is starting to check mailbox forwards.
- Iterates over each mailbox in the
$mailboxes
collection:- Prints the display name and primary SMTP address.
- Checks if the
DeliverToMailboxAndForward
property isTrue
:- If
True
, indicates that email forwarding is active. - Prints forwarding status and forwarding SMTP address in red.
- If
The script uses color-coded messages to represent mailbox forwarding status:
- Green: No forwarding enabled and no forwarding address present.
- Yellow: Forwarding disabled but forwarding address present.
- Red: Forwarding enabled.
This script helps administrators identify mailboxes with email forwarding enabled, providing a clear view of forwarding configurations in their Exchange Online environment. The output includes color-coded feedback and detailed information for each mailbox.