I am running the following script on a scheduled task to check the replication status on our Exchange server(s)

$FromAddress= "HIDDEN FOR OBVIOUS REASONS"
$ToAddress= "HIDDEN FOR OBVIOUS REASONS"
$MessageSubject= "Exchange Replication Report"
$MessageBody= get-content ./filename.txt
$SendingServer= "HIDDEN FOR OBVIOUS REASONS"

Get-StorageGroupCopyStatus -StandbyMachine glblade3 -server wmexchserver1 | select-object identity, summarycopystatus | format-table -wrap | Out-File filename.txt

$SMTPMessage= New-Object System.Net.Mail.MailMessage $FromAddress, $ToAddress, $MessageSubject, $MessageBody

$SMTPClient = New-Object System.Net.Mail.SMTPClient $SendingServer
$SMTPClient.Send($SMTPMessage)

In short it runs the test "Get-StorageGroupCopyStatus", outputs to a text file and then emails the contents of the file.

Problem is the formatting on the contents is terrible, the text is cut off in places and it is plain text so it doesn't know when to do a carriage return, this makes it horrible on the eyes.


Any idea's ?
Mike