Skip to content

Instantly share code, notes, and snippets.

@sdaaish
Created June 14, 2018 13:09
Show Gist options
  • Save sdaaish/21a0e726069bf3611ad422dbd23dc650 to your computer and use it in GitHub Desktop.
Save sdaaish/21a0e726069bf3611ad422dbd23dc650 to your computer and use it in GitHub Desktop.
List email forwarding O365
$Mailboxes = Get-Mailbox -ResultSize Unlimited
ForEach ($Mailbox in $Mailboxes)
{
$MailboxWithRule = Get-InboxRule -Mailbox $Mailbox.Alias |
where
{
($_.RedirectTo -ne $null) -or ($_.ForwardTo -ne $null) -or ($_.ForwardAsAttachmentTo -ne $null)
}
if ($MailboxWithRule -ne $Null)
{
Write-Host "Brevlådan $($Mailbox.PrimarySmtpAddress) har dessa regler:" $MailboxWithRule |
fl Name, Identity, RedirectTo, ForwardTo, ForwardAsAttachmentTo
}
}
@sdaaish
Copy link
Author

sdaaish commented Jun 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment