Problem:
How do I find all Office 365 mailboxes with forwards configured using PowerShell
Solution:
The below command will show all shared mailboxes that have forwards configured:
Get-Mailbox -RecipientTypeDetails SharedMailbox | Where {($_.ForwardingSMTPAddress -ne $null) -or ($_.ForwardingAddress -ne $null)} | Select Name, ForwardingSMTPAddress, ForwardingAddress, DeliverToMailboxAndForward | export-csv c:\temp\forwards.csv
In we can change the RecipientTypeDetails to use any of the below object types:
Member name | Description | |
---|---|---|
None | ||
UserMailbox | ||
LinkedMailbox | ||
SharedMailbox | ||
LegacyMailbox | ||
RoomMailbox | ||
EquipmentMailbox | ||
MailContact | ||
MailUser | ||
MailUniversalDistributionGroup | ||
MailNonUniversalGroup | ||
MailUniversalSecurityGroup | ||
DynamicDistributionGroup | ||
PublicFolder | ||
SystemAttendantMailbox | ||
SystemMailbox | ||
MailForestContact | ||
User | ||
Contact | ||
UniversalDistributionGroup | ||
UniversalSecurityGroup | ||
NonUniversalGroup | ||
DisabledUser | ||
MicrosoftExchange | ||
ArbitrationMailbox | ||
MailboxPlan | ||
LinkedUser | ||
RoomList | ||
DiscoveryMailbox | ||
RoleGroup | ||
RemoteUserMailbox | ||
Computer | ||
RemoteRoomMailbox | ||
RemoteEquipmentMailbox | ||
RemoteSharedMailbox | ||
PublicFolderMailbox | ||
TeamMailbox | ||
RemoteTeamMailbox | ||
MonitoringMailbox | ||
GroupMailbox | ||
AllUniqueRecipientTypes |