Sharing my (flash / usb) drive checker software before backup

Discussion in 'Acronis True Image Product Line' started by Ger Teunis, Apr 12, 2008.

Thread Status:
Not open for further replies.
  1. Ger Teunis

    Ger Teunis Registered Member

    Joined:
    Mar 31, 2008
    Posts:
    8
    Sharing my (flash / usb) drive availability checker (before backup)

    If you, just like me, would like to create backups on a removable HD or Flashdrive; you will notice Acronis TrueImage will silently fail your scheduled backup when your drive isn't inserted.

    I've created this program especially for this.
    It will check if a specified drive letter is available, if not: it will ask for it.
    After the drive is correctly attached it will start the backup tasks.

    How to create a windows scheduled task to use this util

    1. Extract the downloaded Zip to any location
    2. Make sure your backup task in trueimage has the "ask for first media..." option DISABLED in "Additional settings".
    3. Locate your backup script file
    Common locations are:

    WinXP:
    C:\Documents and Settings\All Users\Application Data\Acronis\TrueImage\Scripts\

    Vista:
    C:\ProgramData\Acronis\TrueImageHome\Scripts\

    4. Locate the acronis service exe file
    Common location is:
    c:\Program Files\Common Files\Acronis\TrueImageHome\TrueImageHomeService.exe

    5. Using notepad, open the InsertFlashDrive.exe.config file and insert the drive letter to check for in "DriveLetter", update the path below "AcronisServiceExe" setting (use step 4) and update the "AcronisScriptFile" setting (use step 3)

    6. Test by starting the InsertFlashDrive.exe, it should check for driveletter and start the backup correctly.

    7. Schedule a task in task scheduler to start the InsertFlashDrive.exe, make sure you enabled "run with highest priviliges" in Vista.

    That's all, if there is enough feedback I will implement an options screen.
    Hope this tool will help you create backups on your removable media!

    Download:
    http://www.wenus.demon.nl/downloads/InsertFlashDrive.zip

    ps> .NET framework 2.0 is required.
     

    Attached Files:

    Last edited: Apr 12, 2008
  2. MudCrab

    MudCrab Imaging Specialist

    Joined:
    Nov 3, 2006
    Posts:
    6,481
    Location:
    California
    Thanks for sharing this.

    If you don't mind, I have a few questions:

    Will this only work when using the Windows Task Scheduler? (It won't work when using TI's scheduler.)

    Will it wait indefinitely for the USB device to be plugged in or will it time-out after a while and cause the backup to fail?

    When it checks for the USB device, is it only checking if the drive letter is accessible or is it checking that the actual wanted device is plugged in? Some people use multiple devices and they all get the same drive letter if they are the only one plugged in.
     
  3. Ger Teunis

    Ger Teunis Registered Member

    Joined:
    Mar 31, 2008
    Posts:
    8
    Good suggestions:

    It will also work by directly calling the exe file (double click or some batch file i.e.).
    Acronis scheduler: i'll investigate, but if I am correct a pre-command in a given task will be executed too late, failing because the drive isn't there.

    At the moment it will wait forever, only if the drive isn't inserted at the moment. If the drive is already available it will continue directly.
    Implementing an optional timeout is possible. Perhaps I'll poll every x seconds to auto-continue, without the need to click on "Continue".

    Drive letter, but a volume-serial-number (unique id) check is implemented easily, great suggestion.
     
  4. MudCrab

    MudCrab Imaging Specialist

    Joined:
    Nov 3, 2006
    Posts:
    6,481
    Location:
    California
    Actually, I've already tested this and it's how my program works. The pre-command does get called before TI looks for the device.

    A time-out option may be nice for some, but personally I wouldn't want a time-out. I was just curious if it would. Some other backup programs only allow so much time for a pre-command to run before proceeding. I haven't used Windows Task Scheduler to run TI backups so I wasn't sure if it had this problem or not.

    The "auto-continue" feature is one that I haven't added yet, but plan to. It just makes it a little easier. You plug in the drive, it's detected and the backup proceeds automatically.
     
  5. Ger Teunis

    Ger Teunis Registered Member

    Joined:
    Mar 31, 2008
    Posts:
    8
    Weirdly enough, when my program is starting I get a start error in TI, error code 1. While the test button correctly works! I return the right resultcode from the program, only when the continue or cancel button is clicked.
    "Execution of user command .... failed. Error code: 1"
    Work dir and correct paths are configured, did you encounter this error before?

    Indeed, I agree.
     
  6. MudCrab

    MudCrab Imaging Specialist

    Joined:
    Nov 3, 2006
    Posts:
    6,481
    Location:
    California
    TI's scheduler does not support any interactive commands. This is why you get the error. Running in "test mode" works because the process is running as a normal process. When it's run as a scheduled task there isn't any normal access available between "normal" processes and the TI processes including a pre-command program. (I've checked this by running a process viewer from the task.)

    No programs that display windows or ask for input will work. You can setup the pre-command to open Notepad with a file (or even just start the program) and the program will not appear. However, it will be in the process list.

    My program is actually in two parts. One part runs as the pre-command and the other runs as a normal Windows process started when Windows boots (like in the Startup folder). When the task begins, the pre-command program "talks" to the "outside process/task" program which then checks for the drive and displays the interactive message. When the continue button is clicked, the pre-command program is notified and the backup continues as normal.
     
  7. Ger Teunis

    Ger Teunis Registered Member

    Joined:
    Mar 31, 2008
    Posts:
    8
    Too bad no user interaction is allowed.
    Your program: great stuff, perhaps you could share that one also?
    My solution is the low-tech variant, I can imagine some will want your program!
     
Thread Status:
Not open for further replies.