Email notifications for DriveImage XML – 110% FREEWARE

This world that we live in is a brutal place, driven by massive money making machines. The cogs of these money making machines, are individuals who spend without thinking or researching. So for those of you who do, im thankful you’ve come across my post, and as far as I know its the only post on the web describing how to get email notifications from DriveImage XML, and how to implement a really decent backup system for FREE! Just like everyone else, I hate being ripped off, and here’s how I came to writing this guide: I was running Acronis True Image Home 2011 on a friend’s windows xp machine, and it truly is a wonderful piece of software which images your drives and provides services such as email notifications. This version costs $49 which is reasonable and worth the money you pay for it. These bastards however have another trick up their sleeves, when they try and milk $853 out of you for the server edition. Since my mate needed Server 2008 instead of the windows xp machine, a new backup solution had to be considered. Acronis True Image Home started shouting that it cannot be installed on a server platform, which is fair enough, but having to pay $853 for their server edition, I decided to drop them like a bad dream, and this is what I did for an entirely free backup system on Windows Server 2008.

1.I Installed DriveImage XML
2.Got hold of a command line email program called bmail
3.Configured DriveImage XML to produce a log file → Click tools → Click options → Enable logging
4.Create a nifty batch file which handles renaming the log file and the emailing it to however many email addresses you want.

Before I even get into the batch file which makes everything happen, I would like to cover the process involved in renaming the log file with the current date and time. While I was fiddling with the formatting of the date and time, I found that some computers formatted things differently from others when renaming via the command prompt. Im not exactly sure why this is the case, but I would assume it is something to do with the time zone and/or some other formatting pertinent to the computer on which you’re implementing this backup solution.

The whole point of renaming the log file, is so that you can keep track of which log file is for what date and time. DriveImage XML creates a default file named “log.txt” in the default path: “C:Program FilesRuntime SoftwareDriveImage XMLlog.txt”

So you can imagine that if this log file is left in this location and you have a backup running everyday, you will have information relating to previous day’s backups in this log file, which is obviously not what you want. All you want, or all I want is a log file with information stating whether today’s backup has completed successfully or not. The previous day’s backups will be copied and renamed according to the date and time on which they occurred. Of course you would have to customize how you want your log file renamed, and the example below is in South African date time formatting: dd_mm_yyyy_timeHoursTimeMinutes

Go to start → run → type cmd → press enter

Type in: echo %date%

This will give you the current date. Then type: echo %date:~7,2%
This should give you the day. To break this command down, 7 is the starting point of the substring, and 2 is the number of decimal places from the beginning of the substring. In order to get the format as you would like it, fiddle with the values after the ~.
echo %date:~4,2% should give you the month, and %date:~10,4% should give you the year. 4 represents the 4 numerals in the date: 2010. Below is the batch file which handles the renaming, and emailing of the log file:

REM This batch file uses bmail to send the log file to the -t address
REM This batch file copies the workstation log file to the server
REM This batch file renames the latest log file with the current date and time

cd “C:FreeFileSync Batch Backupsbmailv107”

bmail -s -t -f -a “Subject header of the email” -m “C:Program FilesRuntime SoftwareDriveImage XMLlog.txt”

move “C:Program FilesRuntime SoftwareDriveImage XMLlog.txt” “C:Documents and SettingsAdministratorMy DocumentsBackup logs”
ren “C:Documents and SettingsAdministratorMy DocumentsBackup logslog.txt” ServerBackupLog_%date:~4,2%%date:~7,2%%date:~10,4%_%time:~1,1%%time:~3,2%.txt

As you can see, the first command in the batch files changes the directory to the same place where the bmail.exe is stored. For simplicities sake, keep the batch file and the bmail command line emailer in the same directory.

The second command is pretty self explanatory, and handles emailing the log file. -s specifies the smtp server which you are going to use. In this case I am using the Internet Solutions smtp server which is free for any existing South African domain ( -t specifies the email address where you want to send the log file. -f specifies the address from which email is to be “sent” from. You can send the email from any existing South African domain. -a specifies the Subject header of the email containing the log file. -m specifies the path to the log file. Since this is a text file, the information contained in the log file will simply be displayed in the body of the email (I.e not in an attachment)

The third command moves the log file from the default directory “C:Program FilesRuntime SoftwareDriveImage XMLlog.txt” to wherever you want the log file to be placed. In this case, the log file is copied to the Backup logs folder in the My Documents directory.

The fourth command renames the log file as follows:

Of course the time is dependent on AM or PM. If you plan on sending your backup email notification in from 12:00 AM through to 09:00 AM, your substring will look like the time value above: %time:~1,1%. So the above email notification is configured for AM. The reason for the 1,1 is due to AM times being formatted as follows: 1AM in the morning is formatted as: 1:00, therefore the substring would be different from 13:00 where you have 2 placeholders representing the hour value.

The above batch file would of course be scheduled to run soon after the DriveImage XML backup has completed. So you’d have to check how long your backup takes to complete.
If you want to email the log file to more than one email address, just copy and past the following line, each time filling in the appropriate email address:

bmail -s -t -f -a “Subject header of the email” -m “C:Program FilesRuntime SoftwareDriveImage XMLlog.txt”

You may think that simply separating the email addresses with a semi-colon would do the trick, well it doesnt – iv tried.

So this then completes the tutorial on how to send email notifications of backups from DriveImage XML. Everything is FREEWARE, and none of this free to try kak that you always see.

DriveImage XML doesnt perform incremental backups, which some may say is a disadvantage, but I personally dont like incremental backups, as they just seem a little sketchy. I perform a complete backup every single day, which takes place at night when the staff arent using their machines. If the server is on all night, why not just be safe and do a full backup which doesnt take much longer than 2 hours.

And thats it ladies and gents! Please could you comment on this post it you found it useful and give many any comments and/or suggestions! Soon ill be writing a guide on email notifications for avast and spybot search and destroy.

Over n out!