::这个脚本用计划任务执行后,可以对WINDOWS Backup的文件夹进行监视,如果没有新的备份产生,则发送EMAIL到指定的地址。

::脚本允许一次事件,第二次事件后才发送告警。

@echo off

SETLOCAL 

SETLOCAL ENABLEDELAYEDEXPANSION

SET destinationfolder=H:\WindowsImageBackup\MBM-SBS

set emailServer=smtp.yourISP.com

SET emailFrom=BackupMonitor@mycompany.com

SET emailTo=cliffz@mycompany.com

set emailSubject=Backup not completed in %computername%

SET emailBody=Please check BackupPC on Windows Backup ! Other running backup jobs might interfere Windows Backup.

dir /w "%destinationfolder%\Backup %date:~-4%-%date:~4,2%-%date:~7,2%*.*"

if ERRORLEVEL 1 GOTO NOBACKUP

del c:\Scripts\failedDay1.log

GOTO END

:NOBACKUP

if exist c:\Scripts\failedDay1.log goto :emailalert

echo day1 failed > c:\Scripts\failedDay1.log

goto end

:emailalert

C:\Scripts\SMTPSend.exe h=%emailServer% s=%emailFrom% r=%emailTO% t="%emailSubject%" b="%emailBody%"

:END

echo %date% > c:\scripts\FolderMonitorIndicator.log

ENDLOCAL ENABLEDELAYEDEXPANSION 

ENDLOCAL