Posts

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
note:

test-systemhealth

 test-servicehealth
 

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 = “from@emailaddress.com
$msg.To.Add(“to@emailaddress.com”)
$msg.Subject = “CCR Status”
$msg.Body = “Attached is the CCR status”
$msg.Attachments.Add($att)
$smtp.Send($msg)

Go into task scheduler

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