#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
$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