Exchange Server 2013 Content Index and Replication log status


The below script will helps to sort the progess percentage of content index seeding and also number of log files pending for replication. The output of the file will be saved in the desktop and also it will sent as email with an attachment

# Where to store output
$savefile  = $env:USERPROFILE + ‘\Desktop\’ +((Get-Date).ToString(“dd_MM_yyyy_HHmm”))+’.html’

#Preformat HTML document
$a = “<style>”
$a = $a + “BODY{background-color:peachpuff;}”
$a = $a + “TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}”
$a = $a + “TH{border-width: 1px;text-align: center; margin: 2px;padding: 0px;border-style: solid;border-color: black;background-color:thistle}”
$a = $a + “TD{border-width: 1px;text-align: center; margin: 2px;padding: 0px;border-style: solid;border-color: black;background-color:PaleGoldenrod}”
$a = $a + “</style>”

# Function to for the Output

$Output = Get-MailboxServer | Get-MailboxDatabaseCopyStatus | ?{($_.CopyQueueLength -ne “0”) -or ($_.ContentIndexState -ne “Healthy”)} |Select Name,Copyqueuelength,ContentIndexSeedingPercent,ContentIndexState | Sort-Object CopyQueueLength -desc | ConvertTo-Html -head $a -body “<H2>Exchange 2013 Content Index Status</H2>”

$Report = $Output |Out-File $savefile

# This will open report in your default browser.
Invoke-Item  $savefile

#To Send Email

$MailTo = “Raji.Subramanian@mail.com”
$MailFrom = “Admin@mail.com”
$MailServer = “Exserver.mail.com”

Send-MailMessage -Attachments $savefile -To $MailTo -From $MailFrom -Subject “Exchange 2013 Content index Status Report” -Body ( $Output | out-string ) -bodyashtml -SmtpServer $MailServer

To add them in the task schedule copy the below command and paste them in the command of new task

C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe -Command “.’E:\Program Files\Microsoft\Exchange Server\V15\Bin\RemoteExchange.ps1′; Connect-ExchangeServer -auto; C:\Scripts\CI_Status.ps1

Advertisements

About Raji Subramanian

Nothing great to say about me...Just want to share my knowledge for others that will be useful at any moment of time when they stuck in critical issue....
This entry was posted in Exchange Server 2013, Exchange Server 2013 Content Index Replication and tagged . Bookmark the permalink.

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