<

Go Premium for a chance to win a PS4. Enter to Win

x

When Windows 7 Backup Restore Won't

Published on
10,966 Points
3,866 Views
1 Endorsement
Last Modified:
First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition backup.

The image backup is sometimes problematic if you move the image file or it is stored on removable media. Sometimes the image restore utility will not see the backup. Which is a real pain as you know it exists and you need to restore but it won't restore out of the box.

Sometimes you can mount the vhd and copy the files off that you need, and other times you need to do an actual restore.

In an emergency you can if the .vhd is on an internal drive is to boot from the vhd itself.but this is only a stopgap measure.

To accomplish this you mount the vhd either using the GUI disk management tool or the command line diskpart tool.

The hardest part of this is the actual file-name that the .vhd is stored as a rather cryptic GUID i.e.  9bee53fc-ffc3-11e0-bc38-806e6f6e6963.vhd.  You can copy this file to another name or rename it for convenience to something more manageable.

once you have mounted the vhd as a drive from an elevated command prompt you run
the following sequence of commands to add this to the bcdstore


C:\>bcdedit /copy {current} /d "My Virtual Hard Drive OS"
This adds the entry so when your computer boots you will know which version to click to start the correct operating system,  You can replace "My Virtual Hard Drive OS" to whatever you would prefer. And it will return the GUID of the Loader Object that you will use to replace <guid> in the next step.  Use the mark and copy to make it easy on yourself.  You get access to this by left clicking on the c:\ box on the top left, select edit, then mark and then left click the blinking block where you want to start the copy and release at the end of the block you want to copy.  Once you release the mouse it will be copied to the clipboard.

Replace <GUID> with the text you copied.

C:\>bcdedit /set <guid> device vhd=[driveletter:]\<directory>\<vhd filename>
C:\>bcdedit /set <guid> osdevice vhd=[driverletter:]\<directory>\<vhd filename>

Note: vhd=[driveletter:]\<directory>\<vhd filename> is the new syntax supported for BCDEdit.exe to locate the VHD File and Bootmgr will locate the partition containing the VHD File to boot from.

C:\>bcdedit /set <guid> detecthal on

Just to confirm that it is correct use the
bcdedit /v

To undo this type: bcdedit /delete <guid> /cleanup

For a better solution that does an equivalent of the Windows Image restore what I do is transform the .vhd (virtual hard disk) into a .wim file (Windows Image File) using the tools in the Windows Automated Installation Kit. (1.3G)

What I do is build a custom boot disk that includes imagex and for my convenience Gimagex

After you have installed the WAIK here are some batch files for you can now convert the .vhd to a wim

1. mount the vhd
2. either using imagex or gimagex

c:\program files\windows aik\toolsamd64 (or x86)\imagex /capture d: c :\image\myimage.wim " My Converted VHD"

replace d: with the drive of the mounted .vhd

while this is working lets create our boot disk (Windows PE 3.0)


REM 1-MakePE Directory.bat
REM This will delete and re-create a directory called C:\PE\winpe_x86
REM You must have the Windows Automated Installation Kit installed for this to work.

rd /s/q %systemdrive%\PE

%systemdrive%
cd "%programfiles%\windows aik\tools\petools"
call copype.cmd x86 %systemdrive%\PE\winpe_x86
copy "%systemdrive%\PE\winpe_x86\winpe.wim" "%systemdrive%\PE\winpe_x86\ISO\sources\boot.wim"
pause
-----------------
REM 2-Mount.bat
REM This mounts the boot.wim file which is the operating system itself and allows you to edit its settings.
Anything you put in this mounted directory will be in the X:\ drive when the pe is booted. There is also a
folder called ISO--this is where you want files just on the CD but not in the mounted image.

%systemdrive%
cd \
cd %programfiles%\Windows AIK\Tools\x86\Servicing"
DISM /Mount-wim /WimFile:%systemdrive%\PE\winpe_x86\ISO\sources\boot.wim /index:1 /MountDir:%systemdrive%\PE\winpe_x86\mount
pause
-------------------
REM 3-Packages.bat
REM This installs the packages into the image which include HTA, MDAC, Scripting, WDS and WMI.
%systemdrive%
cd \
cd "%programfiles%\Windows AIK\Tools\x86\Servicing"
dism /image:%systemdrive%\PE\winpe_x86\mount /Add-Package /PackagePath:"%systemdrive%\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-wmi.cab"
dism /image:%systemdrive%\PE\winpe_x86\mount /Add-Package /PackagePath:"%systemdrive%\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-hta.cab"
dism /image:%systemdrive%\PE\winpe_x86\mount /Add-Package /PackagePath:"%systemdrive%\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-mdac.cab"
dism /image:%systemdrive%\PE\winpe_x86\mount /Add-Package /PackagePath:"%systemdrive%\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-scripting.cab"
dism /image:%systemdrive%\PE\winpe_x86\mount /Add-Package /PackagePath:"%systemdrive%\Program Files\Windows AIK\Tools\PETools\x86\WinPE_FPs\winpe-wds-tools.cab"
echo The packages have now been installed and will now be prepared.
dism /image:%systemdrive%\PE\winpe_x86\mount\ /Get-Packages
pause
----------------
@echo off
echo 4-Drivers.bat
echo This installs various drivers to your PE Image. Edit this accordingly to include SCSI,
echo SATA, NIC, and other drivers.
echo Syntax is "Dism /image:DRIVE:\Temp\Mount /Add-Driver /driver:DRIVE:FOLDER\*.inf"
set SOURCE=(path to your drivers)
set MOUNTPATH="%systemdrive%\PE\winpe_x86\mount"
%systemdrive%
cd \
cd "%programfiles%\Windows AIK\Tools\Servicing\"
echo Examples:
echo 3Com 3C90X family NIC drivers
Dism /image:%mountpath% /Add-Driver /driver:%source%\3Com3C90X\W9X90XBC.INF
Dism /image:%mountpath% /Add-Driver /driver:%source%\3Com3C90X\W9XEL90X.INF
echo 3Com 3CCFE575CT family NIC drivers
Dism /image:%mountpath% /Add-Driver /driver:%source%\3Com3CCFE575CT\NET575N5.INF
echo Linksys EG1032v1
Dism /image:%mountpath% /Add-Driver /driver:%source%\LinksysEG1032\v1\EG103264.inf
echo Linksys EG1032v2
Dism /image:%mountpath% /Add-Driver /driver:%source%\LinksysEG1032\v2\EG1032v2.inf
echo Linksys EG1032v3
Dism /image:%mountpath% /Add-Driver /driver:%source%\LinksysEG1032\v3\EG1032v3.inf
echo Dell Optiplex 170L Intel NIC Drivers
Dism /image:%mountpath% /Add-Driver /driver:%source%\Optiplex170L\Intel\WinXP\E100B325.inf
echo Dell Optiplex 320 Broadcom NIC Drivers
Dism /image:%mountpath% /Add-Driver /driver:%source%\Optiplex320\Broadcom\WinXP\b44win.inf
echo Dell Optiplex 360 Broadcom NIC Drivers
Dism /image:%mountpath% /Add-Driver /driver:%source%\Optiplex360\k57nd60x.inf
echo Dell Optiplex 755 Broadcom NIC Drivers
Dism /image:%mountpath% /Add-Driver /driver:%source%\Optiplex755\Broadcom\WinVista\b57nd60x.inf
echo Dell Optiplex 755 Intel NIC Drivers
Dism /image:%mountpath% /Add-Driver /driver:%source%\Optiplex755\Intel\Vista32\E1E6032.inf
Dism /image:%mountpath% /Add-Driver /driver:%source%\Optiplex755\Intel\Vista32\E1G6032.inf
echo Dell Optiplex 760 Intel NIC Drivers
Dism /image:%mountpath% /Add-Driver /driver:%source%\Optiplex760\E1K6032.inf
echo The drivers have now been injected into your PE image.
pause
---------------
echo 3rd party driver list
Dism /image:%mountpath% /Get-Drivers
pause
echo All drivers
Dism /image:%mountpath% /Get-Drivers /all
pause
------------
@echo off
echo 5-Additions.bat
echo This will copy various files and folders into your PE image.  They will be loaded to the X:\ drive
echo (the RAM drive) instead of the drive letter of the CD itself.
echo Don't try to load too much into the RAM drive--you'll end up needing a ton of RAM just to
echo use your PE disc, kinda defeating the purpose...

:STEP1
set source=(path to the additional files you want)
set pemount=%systemdrive%\PE\winpe_x86\Mount
goto STEP2

:STEP2
c:
cd \
cd c:\Program Files\Windows AIK\Tools\PETools\

echo Example of copying the contents of a "Tools" folder to the PE RAM drive
echo They will be accessible in the PE environment under X:\Tools.

md "%pemount%\Tools"
xcopy "%source%\Tools\*.*" "%pemount%\Tools\*.*" /e /y

echo
echo Example of copying items to the PE RAM disk's Windows\System32 folder.
echo These items will be accessible from X:\Windows\System32.

xcopy "%source%\Windows\System32\*.*" "%pemount%\Windows\System32\*.*" /e /y

echo The appropriate files have been copied.

pause
-----------------------------
@echo off
REM 6-Unmount.bat
REM Once you are done changing the boot.wim OS file this will unmount the image.
%systemdrive%
cd "%programfiles%\Windows AIK\Tools\x86\Servicing"
DISM.exe /unmount-Wim /MountDir:%systemdrive%\PE\winpe_x86\mount /Commit
pause
----------------
REM 7-MakeISO.bat
REM This makes your .iso image.
cd \
%systemdrive%
cd %programfiles%\Windows AIK\Tools\x86"
oscdimg -n -b%systemdrive%\PE\winpe_x86\etfsboot.com %systemdrive%\PE\winpe_x86\ISO %systemdrive%\PE\winpe_x86\winpe_x86.iso
pause

source: http://tinyurl.com/6uzbuve

add gimageX to your list of tools and we are ready to start. Copy the wim to a removable disk boot from the windows Pe disk that you created above

from the command prompt

dir c: (this may be your windows drive) or the recovery partition
if you don't see \windows then go to the drive that contains the windows directory
we will now format the drive

format x: /q
from the pe disk
imagex /apply d:myimage.wim 1 x:\

boot from the windows 7 disk or the recovery disk and now have it fix up the startup as the GUID of the disk will have changed and bootmgr won't be able to access it.
1
Comment
1 Comment
 
LVL 30

Expert Comment

by:pgm554
3rd party backup vendors should use this article in their marketing material.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Join & Write a Comment

This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
Suggested Courses

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month