Backup Script for visible differential backups

User discussion and information resource forum for scripting of TeraByte products using script lanugages such as TBScript, VBScript, Batch Files, and more.

Backup Script for visible differential backups

Postby dnlathrop » Sat Sep 01, 2012 3:49 pm

I recently switched from another product to ImageForWindows. I like its features and really like the fact it is a relatively small utility (the other product has grown to become much too big and complicated).

Two features that I miss from the other product are: (1) the ability to request a differential backup backup without concern for whether the full-backup file exists, and (2) having a scheduled backup be visible to a user with restricted credentials.

I may need to explain (2). When I use the Windows task scheduler to run IFW with Admin credentials, another user who is logged on at the time the backup is scheduled to run will not see any window or icon in the system tray to indicate the backup is running. If the backup fails or is not scheduled as expected, the user may not realize there is a problem.

I wrote two vbscripts to give me these features. I use it on a WinXP system. My design objectives were:
-- scripts can be run by a user with less than Administrator privileges
-- backup operation is visible to the user
-- differential backup will not fail if full-backup file does not exist

I use two vbscripts. The first script (ImageVolume.vbs) is invoked by the user who specifies the volume to backup, the full-backup file name and the type of backup to take (full or differential). The second script (ImageVolumeProc.vbs) is invoked by the first script. It runs with Admin privileges and it runs ImageForWindows with the needed Admin privileges.

If a differential backup is requested and the full-backup file does not exist, the backup type is changed to full.

I use a third-party freeware program called RunItAs from http://www.chessware.ch to invoke the second script with Admin credentials. Unforunately, using a vbscript in this way opens a hole in system security. The second vbscript could be changed accidentally or intentionally to do something harmful and it would run with elevated privileges. This is not a problem for me because I use this on a system where I am the only user.

This problem could be avoided by either requiring the user to enter the Adminstrator's password or replace the second vbscript with a compiled program that cannot be changed without breaking the RunItAs connection. If you prompt for password, RunItAs is not needed. The second vbscript can be invoked directly using the shell.Run command with the "runas" parameter.

There is at least one other item where there is room for improvement so I welcome comments. The mapping between volume letter and drive/partition numbers is hard coded.

These items may be intolerable for others. For my purposes, I can live with these shortcomings although I would be very interested in learning how to dynamically map volume to drive/partition.

If you wish to use the Windows task scheduler with the first script, you should create a task that invokes wscript with appropriate parameters. For example:
wscript C:\Util\ImageVolume.vbs F H:\Bkups\Volume DIFF

The two scripts are attached. I hope their comments are sufficient to explain how they work. If you do want to use them, you will need to change the code that maps volume letters to drive/parition numbers and probably will want to change file and folder names according to your preferences.

I am not sure what is the proper procedure for this forum. I did not include any type of ReadMe file or identifying information. If that is needed, I will be happy to provide it.

Cheers,
Dave
Attachments
ImageVolume.zip
(4.27 KiB) Downloaded 1494 times
dnlathrop
 
Posts: 7
Joined: Sat Sep 01, 2012 3:21 pm

Re: Backup Script for visible differential backups

Postby TeraByte Support » Sat Sep 01, 2012 5:44 pm

One way would be to use /L output redirected to a file and parsed, but check the manual on the /d: option - the "?" can be used to specific a drive letter and IFW takes care of figuring it out.

> There is at least one other item where there is room for improvement so I
> welcome comments. The mapping between volume letter and drive/partition
> numbers is hard coded.
>
> These items may be intolerable for others. For my purposes, I can live with
> these shortcomings although I would be very interested in learning how to
> dynamically map volume to drive/partition.
TeraByte Support
 
Posts: 2311
Joined: Thu May 05, 2011 3:37 pm

Re: Backup Script for visible differential backups

Postby dnlathrop » Mon Sep 03, 2012 9:09 am

> ... check the manual on the /d: option - the "?" can be used to specific a drive letter and IFW takes care of figuring it out.

Thank you for reply. I had overlooked that form of the /d: parameter.

Revised scripts that use /d:?x are attached.
Attachments
ImageVolume_1_3.zip
(4 KiB) Downloaded 1676 times
dnlathrop
 
Posts: 7
Joined: Sat Sep 01, 2012 3:21 pm

Re: Backup Script for visible differential backups

Postby Cock145 » Fri Jan 23, 2015 12:57 am

I may need to explain (2). When I use the Windows task scheduler to run IFW with Admin credentials, another user who is logged on at the time the backup is scheduled to run will not see any window or icon in the system tray to indicate the backup is running. If the backup fails or is not scheduled as expected, the user may not realize there is a problem.
Last edited by Cock145 on Tue Feb 03, 2015 3:34 am, edited 2 times in total.
Cock145
 
Posts: 1
Joined: Fri Jan 23, 2015 12:55 am

Re: Backup Script for visible differential backups

Postby tas3086 » Fri Jan 30, 2015 10:58 pm

I have a suggestion. Obviously you have programming knowledge. I have a similar problem and possible solution.

If the user has read access to the IFW.log file location, then you can check the status of the operation by looking periodically at the imagew log. Likewise, if the user has read access to the .TBI or .0.. files then you can script looking at the most recent created file to see if it's size is continually increasing.

My scheduler task invokes a TBOS script that logs some additional information to the .log file, creates a started entry in "the Master" another log file, runs that image backup, scans/checks the imagew log file, appends the imagew log file to the master log file, create a imagew Completion code log entry into the master log, and finally deletes the imagew log. Here's a sample entry in the master log file. ( I forgot one important part, put in a powercfg windows command to disable sleep, hibernation, etc before you call imagew, and then re-enable your normal operation parameters after it completes! )

=============================================================================
=================== New Operation Starting ===========================
=================== Date: 10/25/2014 19:05:39 ===========================
=============================================================================
Script Name : C:\Program Files (x86)\TeraByte Unlimited\TeraByte OSD Tool Suite Pro\win\bui9.TBS 2014-10-05 v09.33
Environment : WINDOWS - Option Locking: 0
Backup From : 0@0x4: HP_TOOLS2()
Backup TO : 1@0x1: D_DRIVE(D)
Backup Type : CMPR
Basename : 2013-05-12-1727-HP_TOOLS2-.TBI
Incremental : 2014-10-07-1603-HP_TOOLS2-(I)-.TBI
Comments : NONE
Run Command : IMAGEw.EXE /ue /combine /base:1@0x1:"\2014-10-07-1603-HP_TOOLS2-(I)-.TBI" /f:1@0x1:"\2014-10-07-9999-HP_TOOLS2-"
Options : EXEC,comp,13,,,CMPR
Bios Option : d
EnvironmentD:
EnvironmentW: u;uy;hash;comp:13;max:4GiB;logl:4;logmax:1MiB;logfile:\IFD.LOG;sch:1@0x1:\;;v;wco
EnvironmentL:
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
--------------------------------------------------------------------------
[10/25/2014 19:05:40] /ue /combine /base:1@0x1:\2014-10-07-1603-HP_TOOLS2-(I)-.TBI /f:1@0x1:\2014-10-07-9999-HP_TOOLS2-
[10/25/2014 19:05:41] Image for Windows 2.87 (GUI)
[10/25/2014 19:05:41] Starting ...
IMAGEw.EXE /combine /uy /u /sch:"D:\" /base:"D:\2014-10-07-1603-HP_TOOLS2-(I)-" /f:"D:\2014-10-07-9999-HP_TOOLS2-" /comp:13 /v /max:4GiB /hash
[10/25/2014 19:05:41] Processing: HP_TOOLS2 Partition (04) 2048 MiB FAT-32
[10/25/2014 19:05:41] From: D:\2014-10-07-1603-HP_TOOLS2-(I)-.TBI
[10/25/2014 19:05:41] To: D:\2014-10-07-9999-HP_TOOLS2-.TBI
[10/25/2014 19:05:42] INFO: Total Sectors:4194304 Total Allocated:35960
[10/25/2014 19:05:42] INFO: 35960 Sector(s) backed up
[10/25/2014 19:05:42] Validating: HP_TOOLS2 Partition (04) 2048 MiB FAT-32
[10/25/2014 19:05:42] From: D:\2014-10-07-9999-HP_TOOLS2-.TBI
[10/25/2014 19:05:42] Operation Completed with Error Code 0
[10/25/2014 19:05:42] Stop
[10/25/2014 19:05:42] -***-CMPR HP_TOOLS2 to D_DRIVE-Image processing completed with RC=0
tas3086
 
Posts: 210
Joined: Mon Mar 19, 2012 11:15 am

Re: Backup Script for visible differential backups

Postby dnlathrop » Tue Feb 03, 2015 11:01 am

Thank you for the suggestion.

Could you post your script, or a sanitized version of it if it contains sensitive information?
dnlathrop
 
Posts: 7
Joined: Sat Sep 01, 2012 3:21 pm

Re: Backup Script for visible differential backups

Postby tas3086 » Tue Feb 03, 2015 3:47 pm

I would love to, but can not figure out how to get the file upload attachment to work. Keeps telling me that the extension tbs is not allowed.
tas3086
 
Posts: 210
Joined: Mon Mar 19, 2012 11:15 am

Re: Backup Script for visible differential backups

Postby dnlathrop » Wed Feb 04, 2015 9:02 pm

Perhaps you could rename it with another extension like .TXT or put it into a ZIP file.
dnlathrop
 
Posts: 7
Joined: Sat Sep 01, 2012 3:21 pm


Return to Scripting

cron