:: Created By Joe Davis
:: http://josephmdavis.com/?p=35
:: This script will email the latest backup logfile to a specified user or group.
:: http://www.petri.co.il/forums/showthread.php?t=23825

@echo off

set _SCRIPTNAME=
set _LOGLOCATION=
set _Text2Mail=
set _SUBJECT=”Backup Log for %_SCRIPTNAME%”

:: Email Message Variables
set _EmailTo=
set _EmailFrom=
set _Subject=”SBS Backup Log for xxx”
set _Server=
set _Text2Mail=D:IT_ScriptsEmailBackupLogsScriptlatestbackuplog.txt

Title %_SCRIPTNAME%

for /f “delims=” %%j in (‘dir “%_LOGLOCATION%*.log” /OD /B /A-D 2^>NUL’) do SET “_currentLog=%%j”

If Defined _currentLog (
type “%_LogLocation%%_CurrentLog%” >> “%_Text2Mail%”
cd blat
blat %_Text2Mail% -server %_Server% -to %_EmailTo% -f %_EmailFrom% -s %_Subject%
del “%_Text2Mail%”
) ELSE (echo.Unable to find any backuplog!)