|15 Dec 2011||#1|
System Image .bat script - allow multiple images - WindowsImageBackup
New attachments added 01/19/2012. sysimage.bat updated to clean up a few bugs.
sysimout.txt is an example run of a simulation (no oldest system image delete, no system image).
sysimbkp.txt is an example of a real run to an external drive.
See sysimage.bat or .txt prolog for thorough explanation and examples.
Now has complete space management, round-robin drive selection space option parm file usage. You can now use a parm file that contains all the drives you want images to go to, how many to take consecutively for a single drive before moving to next drive, along with the usual /S-like space management options for each drive (to control deletion of the oldest system image on the target drive just-used for the just-taken system image).
WIB abbreviation represents WindowsImageBackup folder.
This script (attached below) will allow multiple System Images to be kept in the prechosen (by Win7) location of:
Multiple images are accommodated by renaming the next node (\computername\) to append the date and time pulled from the \Backup folder in the next node after that node.
Hence, the original Win7 folder naming convention such as:
drive:\WindowsImageBackup\joe_computer\Backup 2011-12-05 012345
would become (propogating the date/time part to the prior directory node name):
drive:\WindowsImageBackup\joe_computer_2011-12-05_012345\Backup 2011-12-05 012345
Because we are monkeying with the folder name, Win7 System Image backup will do a full backup of the system drive(S) so it will take the usual (full) elapsed time, vs. a "compare" of a prior system image backup that runs much more quickly.
The Windows Recovery Environment (RE) should see all system image folders (WindowsImageBackup):
- on any fixed or removable (external HARD drive)
- as long as the matching shadow entry is in the Shadow Storage area (System Volume Information folder on the MATCHING drive - see WBADMIN part of output of script)
- and the WindowsImageBackup folder is currently on the original target drive from when the system image was taken.
As far as Win7 is concerned, these system images are from different computers and are using the same target drive and WindowsImageBackup folder (as if 2 PCs had system images written to a single, external USB drive).
NOTE: On the Backup and Restore "Manage Space" GUI panel, it will show no system images found (and tile greyed out/unselectable) because the computer name in the WIB folder no longer matches your computer name as it has been appended with the date and time.
Must be run from an elevated command prompt (Administrator - find cmd.exe via start orb search, right-click on cmd.exe and select "run as Administrator").
For Task Scheduler, must be Run As Administrator (SECURITY options on the GENERAL tab, lower part - USE THE FOLLOWING ACCT and also the checkbox "run with highest privileges").
NOTE: I have not tested via task scheduler yet.
x = N - Default=N. Potentially delete oldest folder and potentially perform a system image.
x = Y - information only. No delete, no system image backup performed, no folders renamed.
...................... Y is effectively a simulation run
x - target drive letter (no :). Only needed if /M IMAGE (backup) is specified. /T and /S spaceoptionfile are mutually exclusive parm options.
x = n - Default 999 number of system images to keep for target drive before deleting oldest one
x = nG - keep n GIGABYTES of system images on target drive before deleting oldest one
x = "drive:\fullpathname\...spaceoptionsfile.txt" - contains sequence of drives and disk space mgmt options
format of each entry:
NOTE: Volume name must be in double-quotes if there are embedded spaces.
D = drive letter OR Volume name Or Volume Serial (latter 2 as shown via -fsutil fsinfo volumetype Driveletter:).
C = # Consecutive system images to store on this drive until moving to next (potential) drive
S = typical space parm - n = number of images, nG = Gigabytes of images
D.2.46G "Iomega HDD".4.6 Scatch.1.3
When a System Image needs to be deleted, the oldest one is chosen (amongst System Images found for the target drive). An image will only be deleted if a new image is to take place (/M IMAGE).
Multiple older System Images may be deleted to get the target drive under the specified space threshold. This could occur, for example, the first time you use sysimage.bat but you have, let's say, 3 System Images on drive H. For the space management for H, you have the maximum images set to 2. So, to prepare for the newest System Image that's about to occur, 2 older images would have to be deleted such that the newest one will become the 2nd on on H.
x = NOIMAGE - Default=NOIMAGE. Do not perform a System Image.
x = IMAGE - Perform a system image to either /Target drive or drive from space options file parm.
x = Your Custom WIB Folder - used to just rename or to test
- even if you specify this, the (potential) System Image (/M IMAGE parm option) will still go to /T targetdrive (or target drive via Space Options File):\WindowsImageBackup
Assume script resides in D:\Scripts\sysimage.bat.
D:\Scripts\sysimage.bat /I Y/N /T targetdrive /S max#maxG /M IMAGE/NOIMAGE /W WIBfoldername
In the examples shown below, we will start with basic, informational-only processing and slowly work our parm options to full-blown processing.
- show System Image information only
D:\Scripts\sysimage.bat /I Y
- show System Image information for standard WindowsImageBackup folders and also a custom WIB folder
D:\Scripts\sysimag.bat /I Y /W testwib
- rename WindowsImagebackup folders only (no simulation can rename WIB folders, but NOIMAGE default is used)
D:\Scripts\sysimage.bat /I N
- simulate execution of a System Image to be stored on target drive F - keep 999 (default) images on F
D:\Scripts\sysimage.bat /I Y /M IMAGE /T F
- simulate execution of a System Image using target drive and space info from a parm file
D:\Scripts\sysimage.bat /I Y /M IMAGE /S "D:\Scripts\SI parms.txt"
- perform a System Image to target Drive G keeping 55 Gigabytes of images on drive G
D:\Scripts\sysimage.bat /M IMAGE /T G /S 55g
See sysimage.bat script prolog for more examples.
For runs via Task Scheduler, it is recommended to save output to file. Use a fully-qualified path as if you invoke from Task Scheduler, the default directory at bat script initiation is c:\Windows\System32.
D:\Scripts\sysimage.bat /parm1 X /parm2 Y /parm3 Z.... > drive:\directory...\...\sysimage.txt
- Process parms
- Get all fixed and removable partitions that are mounted/currently live.
- validate parms
- display drive information (fixed/removable)
- Find all \Backup folders in WindowsImageBackup (standard) or user-specified /W WIB folder structure on all mounted fixed/removable disk drives.
- TAKEOWN (ownership to admins) of all WindowsImageBackup folders on all currently-attached drives (or user-specified /W WIB)
- Rename any \WindowsImageBackup\computername\ folders to append _YYYY-MM-DD_HHMMSS
- List shadow storage (vssadmin command). This information can help show how much Shadow storage is used as it could prevent multiple System Images from being held/contained at one time as some Shadow Storage is used for each system image backup. Shadow storage is also shared with Restore Points. Set the shadow storage high enough via Control Panel > System > System Protection. Highlight a drive and click CONFIGURE to set the maximum disk space for a given partition's Shadow storage.
- list System Image event information from Event Viewer
- Display wbadmin GET VERSIONS (includes shadow information) - lists each System Image
- display wbadmin GET ITEMS for specific version (tells what drives were backed up for this system image)
- display any matching \Backup folder, if present in WindowsImageBackup/user /W WIB folder structure, for each System Image represented by an individual Shadow copy entry.
- display shadow-specific information (vssadmin list Shadows /Shadow=)
If you have an existing (via Shadow information) System Image that was written to a drive/partition that is not currently mounted, a warning message will be issued to advise you of such. Warning messages will also be displayed for orphaned (no matching Shadow entry) or wrong drive (Shadow info says System Image stored on target drive Q but a WIB entry was found on a drive other than Q).
- Show disk spaced used for all WindowsImageBackup/user /W WIB folders and subfolders (to help manage /S option setting appropriately) and also aggregate disk space per drive
- Potentially delete a WindowsImageBackup/user /W WIB \Backup folder (depends on /S space parm setting) provided Backup was specified via /M IMAGE parm option. The oldest of all System Images found on the just-used target drive is chosen for deletion. If /M NOIMAGE was specified (or defaulted), no delete is necessary as no impending System Image will occur.
- Start wbadmin backup for only critical volumes (reserved and C: usually but may include drives that USER folders reside upon)
- Verify backup complete via wbadmin GET STATUS (should return an ERROR saying none running)
- Rename newest (e.g. just created) \WindowsImagebackup\computername\ folder to append _YYYY-MM-DD_HHMMSS
- Update space parm option file (if so used)
- Provide final listing showing all attached drives and any System Image folders found for those drives and their respective statuses.
Files attached below...
|My System Specs|
|Thread Tools||Search this Thread|
|Similar help and support threads|
Older Images are lost from a copied WindowsImageBackup folder
I recently got a new laptop and wanted to make a System Image before installing things. So in Windows 7 I used Control Panel > Backup and Restore > Create a System Image and pointed it to save the Image on an external USB hard drive. After installing applications I then went into Backup and Restore...
|Backup and Restore|
System Image - Multiple Drives Only Want to Image one of them
I currently operate a PC with 3 separate HDD. I have my windows 7 and all of my programs installed on a 500 GB HDD. I have all of my files saved to a 2 TB HDD and a 1 TB HDD. I want to do a system image of the 500 GB HDD that has the OS and programs installed on it, however, when I go through to...
|Backup and Restore|
Multiple system images with Windowsimagebackup
Greetings! I've done some searches on google and these forums, but haven't been able to find an answer really to my scenario of concern. I have a hard drive exclusively for system image backups. After PC purchase and setup, I have renamed it WindowsimagebackupOriginal so that it's no longer...
|Backup and Restore|
Looking For Image Viewer To View Multiple Images At Once
Hi folks, I'm looking for a simple image viewer program that will let me view images on my computer at once. I would like the program to be able to let me open up multiple images in seperate windows at once and to have unobtrusive menu bars. Does such a program exist? I have been out of...
|Music, Pictures & Video|
Multiple copies of a system image in Win 7
I have two drives on my Windows 7 (64 bit) computer disk 0 Intel 160 Gb SSD partitioned into c (OS) and a 100 MB reserved partition which was put there as part of the Windows 7 install disk 1 WD 1 TB HDD with two partitions: drive (D) 600 GB for data and drive (K) 375 GB for backups...
|Backup and Restore|
multiple system images
Hello all, Below is a screen shot from disk management. Now the problem is that I must include D: in the system image backup. See below. I only want to include C: as system image.
|Performance & Maintenance|
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd
All times are GMT -5. The time now is 15:12.