Get the ten biggest mailboxes in Exchange 2010 export to report using PowerShell

Get-Mailbox -database  | Get-MailboxStatistics | Sort-Object TotalItemSize -descending |Select-Object DisplayName,ItemCount,@{name=”MailboxSize”;exp={$_.totalitemsize}} -first 10 | Convertto-Html | out-File report.htm

Send a daily html CCR report via Powershell

Create a powershell script to generate the html file

Test-ReplicationHealth | ConvertTo-Html -title “BackupReport CCR” -body “Backup status per Storage Group” | Set-Content E:StorageGroupBackupStatus.html



Create a powershell script to e-mail log file

$filename = “E:StorageGroupBackupStatus.html”
$smtpServer = “RelayServer”
$msg = new-object Net.Mail.MailMessage
$att = new-object Net.Mail.Attachment($filename)
$smtp = new-object Net.Mail.SmtpClient($smtpServer)
$msg.From = “
$msg.Subject = “CCR Status”
$msg.Body = “Attached is the CCR status”

Go into task scheduler

For the program type this
For the arguments use
-PSConsoleFile “C:Program FilesMicrosoftExchange Serverbinexshell.psc1” -noexit -command “. ‘e:SendLogFile.ps1′”