Get Inbox Rule

One thing most of the Exchange Admins has to go through is
User : “I didn’t receive the email sent to me.”
Admin : “have you created any rules?”
User : “Not sure”
Admin : “Let me Check”
… Few seconds later
Admin : “Yes you have a rule please double check that.”

User goes how did you check that? Admin like i have a script and that script is below LOL just tried to be creative on this.

$i = 0
$Mailboxes = Get-Mailbox -ResultSize Unlimited | Select PrimarySMTPAddress, Name
$Mailboxes.Count

ForEach ($Mailbox in $Mailboxes)
{
   $EMailAddress = $null
   $UserName = $null
   $EMailAddress = $Mailbox.PrimarySMTPAddress
   $UserName = $Mailbox.Name

   Write-Host "Name: "$UserName
   Write-Host "Email: "$EMailAddress
   Write-Host "=================================================="

   Get-InboxRule -Mailbox $EMailAddress | FL | Out-File "Result.txt"
      
   Write-Progress -Activity "Searching for Mailbox Rules..." -status "Proccessed $i of $($Mailboxes.Count)" -percentComplete (($i / $Mailboxes.Count)  * 100) -ErrorAction:SilentlyContinue
   $i++
}



Published by iamfazul

Author of the site

Leave a comment