Where Customization Begins 

  • Boot Windows 7 from your EXTERNAL USB HARD DRIVE

  • Here you will find out how to customize from top to bottom your operative system!
Here you will find out how to customize from top to bottom your operative system!
 #848  by Neuropass
 21 Dec 2009, 15:15
Install in IDE/SATA disk and move to USB

1. Attach IDE/SATA disk to computer
You can create a new partition and mark it as active partition before boot from Windows 7 DVD

2. Boot from Windows 7 setup DVD (or other media),
create a partition in SATA (if not already created),
use diskpart to mark partition as active (if it is not the only partition in the computer), install Windows 7

3. Boot from SATA disk into new Windows 7

4. Run cmd as administrator:

Code: Select allbcdedit /set {default} detecthal on

5. Run usbbootfix.bat as administrator

Code: Select all@echo off
if "%1"=="fix" goto :fix

rem -- install task
copy /y "%~f0" "%SystemRoot%\system32\usbbootfix.bat"
SCHTASKS /Create /RU SYSTEM /SC ONEVENT /MO "*[System[Provider[@Name='Microsoft-Windows-UserPnp'] and EventID=20003]]" /EC System /TN USBBootFix /TR "'%SystemRoot%\system32\usbbootfix.bat' fix" /F
rem -- apply other settings
reg add HKLM\SYSTEM\CurrentControlSet\services\pciide /v Start /t REG_DWORD /d 0x0 /f
reg add HKLM\SYSTEM\CurrentControlSet\services\intelide /v Start /t REG_DWORD /d 0x0 /f
reg add HKLM\SYSTEM\CurrentControlSet\services\viaide /v Start /t REG_DWORD /d 0x0 /f
rem -- run :fix once after install

call :fixservice usbehci "Boot Bus Extender"
call :fixservice usbohci "Boot Bus Extender"
call :fixservice usbuhci "Boot Bus Extender"
call :fixservice usbhub  "System Bus Extender"
call :fixservice usbstor "SCSI miniport"
goto :eof

set Start=
set Group=
for /f "skip=2 tokens=1,2,*" %%I in ('reg query HKLM\SYSTEM\CurrentControlSet\services\%~1') do (
  if "%%I"=="Start" set Start=%%K
  if "%%I"=="Group" set Group=%%K
if not "%Start%"=="0x0" reg add HKLM\SYSTEM\CurrentControlSet\services\%~1 /v Start /t REG_DWORD /d 0x0 /f
if not "%Group%"=="%~2" reg add HKLM\SYSTEM\CurrentControlSet\services\%~1 /v Group /t REG_SZ /d "%~2" /f
goto :eof


7.Put SATA disk in USB SATA disk enclosure

or clone Windows 7 to USB disk (see below).

8.Boot from USB disk
When Windows detect new hardware and install drivers automatically, it will also run usbbootfix.bat automatically.

If you install USB drivers (or motherboard or chipset drivers) by other ways, you should run usbbootfix.bat again before shutdown or reboot.

Cloning Windows 7 from IDE/SATA/VHD disk to USB disk

Don't use running Windows as source drive.

1. Attach target disk to computer.

2. Create partition in target disk and format (if not already exists). Mark as active partition.

3. If source BCD is not in source Windows partition, manually copy bootmgr and BCD to target partition.

4. Save clone7.bat it in a directory.

Code: Select all@echo off
rem Source drive, Destination drive
set src=S:
set dst=T:
set bcdentry={default}
set bcddrive=%dst%

echo List of files to be copied
xcopy %src%\ %dst%\ /exclude:%~dp0\cloneexclude.txt /e /c /i /h /k /x /y /b /l
echo Copy files from %src% to %dst%
xcopy %src%\ %dst%\ /exclude:%~dp0\cloneexclude.txt /e /c /i /h /k /x /y /b /w

echo Make sure boot manager are not compressed.
compact /u %dst%\bootmgr %dst%\ntldr %dst%\grldr.* %dst%\menu.lst

echo Adjust \DosDevices\C: value
set dstsignature=
for /f "skip=2 tokens=1,2,*" %%I in ('reg query HKLM\SYSTEM\MountedDevices /v \DosDevices\%dst%') do (
set dstsignature=%%K
reg load HKLM\systemdst %dst%\Windows\system32\config\system
reg add HKLM\systemdst\MountedDevices /v \DosDevices\C: /t REG_BINARY /d %dstsignature% /f
reg query HKLM\systemdst\MountedDevices /v \DosDevices\C:
reg unload HKLM\systemdst

echo Copy bootmgr, BCD to %bcddrive%
if not exist %bcddrive%\bootmgr xcopy %src%\bootmgr %bcddrive%\bootmgr /c /h /k /x /y
if not exist %bcddrive%\Boot\BCD xcopy %src%\Boot\ %dst%\Boot\ /e /c /i /h /k /x /y /b

if not exist %bcddrive%\Boot\BCD goto endbcd
echo Update BCD entry.
bcdedit /store %bcddrive%\Boot\BCD /set {bootmgr} device partition=%bcddrive%
bcdedit /store %bcddrive%\Boot\BCD /set %bcdentry% device partition=%dst%
bcdedit /store %bcddrive%\Boot\BCD /set %bcdentry% osdevice partition=%dst%
bcdedit /store %bcddrive%\Boot\BCD /set %bcdentry% detecthal yes
bcdedit /store %bcddrive%\Boot\BCD


5. Write names of unwanted files and directories in cloneexclude.txt and save in the same directory.

Code: Select all:\RECYCLER
:\System Volume Information
\Temporary Internet Files\

Open cmd.exe running as SYSTEM account.

1. Boot from Windows 7 DVD and press F10 to run cmd.exe. or

2. from another Windows Vista/7 (not on source partition)
Get Sysinternal PsExec. Unzip PsExec.exe. Create shortcut systemcmd.

Code: Select allpsexec.exe -s -i -d cmd

When you run this shortcut as administrator, it will open cmd.exe running as SYSTEM account.
You can increase its screen buffer size by right-click title bar, select Properties, Layout page.

7. Open clone7.bat in notepad or other text editor.
Set appropriate value for src and dst in clone7.bat.
If dst is in VHD, set bcddrive to active partition of the host disk containing dst.

8. run clone7.bat from cmd.exe running as SYSTEM account.
Verify that source and destination drive are correct and press a key to start copy.

9. Shutdown

Another way to install

Install in VHD by using virtual machine (Windows Virtual PC or VirtualBox)
Note : Not all editions of Windows 7 support native-boot VHD.
Only Windows 7 Enterprise and Ultimate (including Release Candidate) support native-boot VHD.

1. Create partition in USB disk (U:), format, make it active partition.
2. Use Disk Management or Diskpart to Create VHD image, size 15GB or more.
3. In Windows Virtual PC folder or VirtualBox, create virtual machine RAM 1GB or more
4. Attach VHD and Windows 7 DVD or ISO to virtual machine
5. Start virtual machine, boot from DVD, install Windows 7
6. Copy usbbootfix.bat to VHD (by network share or mount VHD in host).
7. In virtual machine, run usbbootfix.bat as administrator
8. Shutdown virtual machine.
9. In Disk Management in Windows 7 host, attach VHD.
10. If you just want to use VHD as source for cloning to USB disk, skip the following steps and goto Cloning Windows 7 above.
If you want to native-boot VHD, adjust BCD entry for native-boot VHD with the following steps.
11. Let's assume USB disk partition is U: and Windows partition in U:\name.vhd is V: in host computer
12. Copy bootmgr and Boot directory from V:\ to U:\
13. Run cmd as administrator in host

Code: Select allbcdedit /store U:\Boot\BCD /set {default} device partition=V:
bcdedit /store U:\Boot\BCD /set {default} osdevice partition=V:
bcdedit /store U:\Boot\BCD /set {default} detecthal on

14. detach VHD from host
15. boot from VHD in USB.

karyonix if you are reading this , cheers!