370
Как в Exchange 2016 найти все почтовые ящики с переадресацией
Get-Mailbox | Where {$_.ForwardingAddress -ne $null} | Select Name, PrimarySMTPAddress, ForwardingAddress, DeliverToMailboxAndForward
Отдельный скрипт с выводом в Htlm
Description
This Powershell script gives a HTML output for Exchange mailboxes set with forwarding address. Following information is extracted:
User Mailbox Name
Forwarding Address
Flag (True/False) for «Deliver Message to both forwarding address and mailbox»
Size (MB)
Item Count (n)
Last Logon Time
###################################
# Exchange Mailbox_Forwarding.ps1 #
# Created By mel9484 #
# Date : 03/22/13 #
###################################
$Header = "<h1><center>Mailboxes with Forwarding Address</center></h1>"
$filehtml = "C:\Forwarding_Report.html"
#Define CSS for the HTML Report
$CSS = "<style type=`"text/css`">
TABLE{
direction:LTR;
border-collapse:collapse;
border-style: solid;
border-width: 2px;
border-Color: Black;
font-family: Calibri;
}
td{
direction: LTR;
border-style: solid;
border-width: 2px;
border-Color: Black;
font-family: Calibri;
background-repeat: no-repeat;
background-position: center;
}
th{
border-style: solid;
border-width: 2px;
border-color: Black;
background-color: Yellow;
}
body
{
font-family: Calibri;
background-repeat: no-repeat;
background-position: top right;
}
</style>"
$Data = Get-Mailbox | Where {$_.ForwardingAddress -ne $null} | Select Name, @{Expression={$_.ForwardingAddress};Label="Forwarded To"}, @{Expression={$_.DeliverToMailboxAndForward};Label="Mailbox & Forward"}, @{n="Size(MB)";e = {$stat = Get-MailboxStatistics $_.name ; $stat.totalItemsize.value.toMB()}},@{n="Item Count"; e = {$stat = Get-MailboxStatistics $_.name ; $stat.itemcount}}, @{n="Last Logon Time"; e = {$stat = Get-MailboxStatistics $_.name ; $stat.lastlogontime}}
$Data | ConvertTo-HTML -body $Header -Head $CSS | Out-File $filehtml
Invoke-item $filehtml