#Exchange Forward Inbox Rules

#Exchange2010 #Powershell

So we found out the other day that some has changed the default rule to allow auto forwarding out to the internet .. tut, tut.

Knocked this with up with the Exchange Server 2010 Management Shell.  Not the cleanest bit of code, but does what I need.  Need to work on removing the blanks, but hey, it took 2mins to do! .. you gotta love Powershell! .. gonna take a while for 18,000 mailboxes Disappointed smile

$rulez = @()
$mbxes = Get-Mailbox -ResultSize unlimited
ForEach($mbx in $mbxes){
  $xMailbox = $mbx.Name
  Write-Host $xMailbox
  $xInR = Get-InboxRule -Mailbox $xMailbox | where {$_.ForwardTo -ne $Null} | Select @{Expression={$_.MailboxOwnerId.name};label=”Mailbox”}, Name, RuleIdentify, Enabled, ForwardTo

  $xInR | ForEach {
    $xInRules = “” | Select Mailbox, Name, RuleIdentify, Enabled, ForwardTo
    $xInRules.Mailbox      = $_.Mailbox
    $xInRules.Name         = $_.Name
    $xInRules.RuleIdentify = $_.RuleIdentify
    $xInRules.Enabled      = $_.Enabled
    $xInRules.ForwardTo    = $_.ForwardTo
    $rulez += $xInRules
  }
}

$rulez

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: