cancel
Showing results for 
Search instead for 
Did you mean: 
GertjanA
Moderator
Moderator
Partner    VIP    Accredited Certified

In larger environments, it might be handy to have the Scheduled archiving reports send automatically to a mailbox, to see if there are any issues.

You use a scheduled task to start a CMD file, which calls a powershell script that sends the last available full html files to a specified emailaddress (or addresses). In my environment, EV is installed on the D-drive. Adjust the reference to your situation.

The content of the CMD file:

%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe D:\Support\Scripts\EV_Archiving_Report\Send_archiving_report.ps1

Variables used in the PS1 file:

Variables:
$RootFolder= location of the "Exchange Mailbox Archiving" folder.
$SMTPServer= mail-relay server/smtp host
$MailFrom= Who sends mail, I use Vault Service Account
$MailTo= emailadresses, seperate by using a comma
$MailSubject= Create a subject line

Actual PS1 file:

$RootFolder="D:\Program Files (x86)\Enterprise Vault\Reports\Exchange Mailbox Archiving"
$SuffixFolder="Scheduled"
$ItemPrefix="Full"
$ItemSuffix=".htm"

$SMTPServer="MAILRELAY SERVER"
$MailFrom="FROM ADDRESS"
$MailTo="To Email Address","To Email Address2"
$MailSubject="Archiving Report EV-servername"
$MailBody=@"
Overview of scheduled archiving run.
"@

$SubFolders=Get-ChildItem $RootFolder | ? { $_.PSIsContainer }
$Attachments=@()
foreach($SubFolder in $SubFolders){
       $Folder=Join-Path $SubFolder.FullName $SuffixFolder
       $Item=Get-ChildItem ((Get-ChildItem $Folder) | Sort -Descending LastWriteTime | Select -First 1).FullName | ? { $_.Name -like "$ItemPrefix*$ItemSuffix" }
       $Attachments+=$Item.FullName
}

Send-MailMessage -Attachments $Attachments -Body $MailBody  -Subject $MailSubject -From $MailFrom -To $MailTo -SmtpServer $SMTPServer

 

 

I have this scheduled to run on monday morning, so I see that status of sundays scheduled archiving run.

This has to be implemented on each EV-server, to get the html files of each server.

Version history
Last update:
‎01-19-2015 02:40 AM
Updated by: