Topic: How to fix "Flag 9" in boot.wim when using upgrades  (Read 9977 times)

How to fix "Flag 9" in boot.wim when using upgrades
« on: February 06, 2013, 02:04:45 PM »

halikus

  • Jr. Chef
  • **
  • Date Registered: Feb 2013
  • Posts: 28
Hi ChrisR.  This is a simple fix that may help some people, add a useful feature, and is easy to implement.  When using Win8PESE or Win7PESE to build a boot.wim, upgrading won't work (running setup from within windows to upgrade).  It displays the error message :

"Windows was unable to create a required installation folder. Please reconfigure your boot.wim file to use the flag 9 settings for the first image, and restart your installation"
Error code 0x8030002F

I don't understand the flags fully, but i know how to overcome the problem.  It should be easy to implement before ISO creation.  I scoured google originally to find a fix and all the information was wrong and the general consensus was that the boot.wim was damaged.   In the Win7 OPK help i found the answer.    Use imagex to add the flag 9 switch and rename the name and description. 

ie:
%imagex% /info %~dp0ISO\Win7PE_x86\sources\boot.wim 1 "WinPE 7 (x86)" "WinPE 7 (x86)" /flags "9"
%imagex% /info %~dp0ISO\Win7PE_x64\sources\boot.wim 1 "WinPE 7 (x64)" "WinPE 7 (x64)" /flags "9"
%imagex% /info %~dp0ISO\Win8PE_x86\sources\boot.wim 1 "WinPE 8 (x86)" "WinPE 8 (x86)" /flags "9"
%imagex% /info %~dp0ISO\Win8PE_x64\sources\boot.wim 1 "WinPE 8 (x64)" "WinPE 8 (x64)" /flags "9"

This fixes upgrades and has no adverse side effects when booting the WinPE like normal.


Also, if you wish to know an easy way to have "universal" (all) upgrades available, i do this.

Add Dirs, setup files, and corresponding Winpe.wim renamed boot.wim.  No install.wim. 
sources\w7x86\boot.wim
sources\w7x64\boot.wim
sources\w8x86\boot.wim
sources\w8x64\boot.wim

Add sources\install.wim and sources\boot.wim (any renamed winpe.wim) and a setup.exe.

Then from within Windows in the sources directory, to upgrade, i run :
%~dp0\w7x86\setup.exe /installfrom:%~dp0install.wim"

This uses the Win7 setup files and redirects setup to look for the install.wim in a specific location.

 

Re: How to fix "Flag 9" in boot.wim when using upgrades
« Reply #1 on: February 07, 2013, 01:44:50 PM »

ChrisR

  • Moderator, Win7PE SE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 1610
It seems very well, thanks also for the "universal" tip  :thumbsup:.
You do not use the great "universal" WinNTSetup v2.3

The flag "9" can be done at the capture time in Postconfig, easily indeed by changing:
ps: I have not seen the update of this flag, if Wimutil is used.

Code: [Select]
  If,%pCompressionGroup%,Equal,0,ShellExecute,%ShowImageX%,%IMAGEX%,"/capture #$q%BootTMP%#$q #$q%TargetImage%\sources\boot.wim#$q #$q%ImageName%_%SourceArch%#$q #$q%ImageName%_%SourceArch%#$q /boot /flags #$q9#$q"
  If,%pCompressionGroup%,Equal,1,ShellExecute,%ShowImageX%,%IMAGEX%,"/capture #$q%BootTMP%#$q #$q%TargetImage%\sources\boot.wim#$q #$q%ImageName%_%SourceArch%#$q #$q%ImageName%_%SourceArch%#$q /boot /flags #$q9#$q /compress maximum"


Which gives 
Code: [Select]
    ...
    <NAME>Win8PE_x86</NAME>
    <DESCRIPTION>Win8PE_x86</DESCRIPTION>
    <FLAGS>9</FLAGS>


I'll update  :cheers:
« Last Edit: February 07, 2013, 01:46:12 PM by ChrisR »

Re: How to fix "Flag 9" in boot.wim when using upgrades
« Reply #2 on: February 07, 2013, 02:44:16 PM »

halikus

  • Jr. Chef
  • **
  • Date Registered: Feb 2013
  • Posts: 28
Cheers.  I do use Winnetsetp sometimes depending on the PC, but as far as i know it doesn't work for upgrades.  I am against upgrades, but you never know when you may need to.  The method i use for an all in one USB (Win 7, 8, Vista and XP) is by (I will only use Win7 as an example, repeat for all editions):

DVD:\boot (whole folder)
DVD:\EFI (whole folder)
DVD:\sources\install.wim
DVD:\sources\boot.wim (renamed WinPE.wim)
DVD:\sources\w7x86.exe (renamed Win 7 setup.exe)
DVD:\sources\w7x64.exe (renamed Win 7 x64 setup.exe)
DVD:\sources\w8x86.exe (renamed Win 8 setup.exe)
DVD:\sources\w8x64.exe (renamed Win 8 x64 setup.exe)
DVD:\bootmgr
DVD:\bootmgr.efi
*optional DVD:\sources\w7x86\boot.wim (or renamed WinPE with flag9) and sources folder contents minus install.wim for upgrades
*optional DVD:\sources\w7x64\boot.wim (or renamed WinPE with flag9) and sources folder contents minus install.wim for upgrades
*optional DVD:\sources\w8x86\boot.wim (or renamed WinPE with flag9) and sources folder contents minus install.wim for upgrades
*optional DVD:\sources\w8x64\boot.wim (or renamed WinPE with flag9) and sources folder contents minus install.wim for upgrades
*optional DVD:\EFI\boot\bootx64.efi (from inside efisys.bin or use Refind boot manager renamed to bootx64.efi and refind.conf, icons folder and drivers folders)  **This is for fat32 USB only**
*optional  replace bootx64.efi inside DVD:\EFI\microsoft\boot\efisys.bin with Refind boot manager renamed to bootx64.efi and add refind.conf, icons folder and drivers folders)
* Refind boot manager will boot any efi file, like efi shell, a windows bootx64.efi, grub.efi, etc)  http://sourceforge.net/projects/refind/

Inside (in win 7 x86 as an example) boot.wim, hex edit sources\autorun.dll and replace all instances of setup.exe with w7x86.exe, rename sources\setup.exe to w7x86.exe, and add an autoit file named sources\start.exe with :  Run("x:\sources\w7x64.exe")

This way, when booting the wim and launching setup, setup loads x:\sources\w7x86.exe --> x:\sources\autorun.dll --> DVD:\sources\w7x86.exe and finds the all in one install.wim.  With this you can install any OS, any arch, do boot repair, recovery console, and upgrades.

I also have a gui i use within WinPE to help with install, and an $OEM$ folder in x:\sources (so i can change files, etc as its a ram disk), and can extract the setup files for any OS to x:\sources but thats another story.

But yes, Winnetsetp can be simple and fast if you know what you are doing and understand partitioning, boot records and the boot loader.

I also use this script to add a bunch of features to the BCD

Code: [Select]
@echo off
title Windows BCD manipulation
:checkPrivileges
NET FILE 1>NUL 2>NUL
if '%errorlevel%' == '0' ( goto gotPrivileges ) else ( goto getPrivileges )
:getprivileges
if '%1'=='ELEV' (shift & goto gotPrivileges) 
setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
ECHO set UAC = CreateObject^("Shell.Application"^) > "%temp%\OEgetPrivileges.vbs"
ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"
exit /B
:gotPrivileges

set BCD=%~dp0BCD
set VHDname=VHD.vhd
set PartitionLetter=d:
Set BCDEDIT=%SYSTEMROOT%\System32\BCDEDIT.exe
set STORE=/store %BCD%
%BCDEDIT% /createstore %BCD%
set WINLOAD=winload.exe
set Partition=boot
set Path=[boot]\sources
set SDI=[boot]\boot\boot.sdi
set choice=
set CopyBCD=%DvdOverlay%\boot\BCD


:STARTBCD
del %~dp0BCD /Q
title Choose desired BCD
cls
echo.
echo.
echo    Choose BCD type...
echo.         
echo.
echo   1 = Custom DVD MBR BCD
echo.
echo   2 = Custom DVD EFI BCD
echo.   
echo   3 = Custom HDD MBR  (Edit System BCD)
echo.
echo   4 = Custom HDD EFI  (Edit System BCD)
echo.
echo.
echo.
SET /P IM=Input number :
SET DD=
If "%IM%"=="1" goto :DVDMBR
If "%IM%"=="2" goto :DVDEFI
If "%IM%"=="3" goto :HDDMBR
If "%IM%"=="4" goto :HDDEFI
If "%DD%"=="" echo INVALID NUMBER
If "%DD%"=="" goto :STARTBCD


rem *****************Choose specific variables**********************************
:DVDMBR
set STORE=/store %BCD%
%BCDEDIT% /createstore %BCD%
set WINLOAD=winload.exe
set Partition=boot
set Path=[boot]\sources
rem set SDI=%SYSTEMROOT%\Boot\DVD\EFI\boot.sdi
set SDI=[boot]\boot\boot.sdi
set choice=
set CopyBCD=%DvdOverlay%\boot\BCD
goto :STARTBCD2

:DVDEFI
set STORE=/store %BCD%
%BCDEDIT% /createstore %BCD%
set WINLOAD=winload.efi
set Partition=boot
set Path=[boot]\sources
rem set SDI=%SYSTEMROOT%\Boot\DVD\EFI\boot.sdi
set SDI=[boot]\boot\boot.sdi
set choice=EFI
set CopyBCD=%DvdOverlay%\efi\microsoft\boot\BCD
goto :STARTBCD2

:HDDMBR
set STORE=
rem %BCDEDIT% /createstore
set SDI=%SYSTEMROOT%\Boot\DVD\PCAT\boot.sdi
set WINLOAD=winload.exe
set Partition=Partition=%PartitionLetter%
set Path=[%PartitionLetter%]\sources
set choice=
%BCDEDIT% /set {current} bootmenupolicy standard
goto :STARTBCD2

:HDDEFI
set STORE=
rem %BCDEDIT% /createstore
set SDI=%SYSTEMROOT%\Boot\DVD\EFI\boot.sdi
set WINLOAD=winload.efi
set Partition=Partition=%PartitionLetter%
set Path=[%PartitionLetter%]\sources
rem set PATH=\efi\microsoft\boot\bootmgfw.efi
set choice=EFI
%BCDEDIT% /set {current} bootmenupolicy standard
goto :STARTBCD2



:STARTBCD2
title BCD manipulation
del %~dp0BCD.LOG  /Q
rem %BCDEDIT% %STORE%
cls
echo.
echo   1 = Custom DVD %choice% %BCD% with everything
echo.
echo   2 = ** Custom HDD %choice% %BCD% with everything ** (Will change system)
echo.
echo.
echo.
SET /P IM=Input number :
SET DD=
If "%IM%"=="1" goto :CREATECUSTOMDVD%choice%
If "%IM%"=="2" goto :CREATECUSTOMHDD%choice%
If "%DD%"=="" echo INVALID NUMBER
If "%DD%"=="" goto goto :StartBCD


:CREATECUSTOMDVD
call :CREATEBCD
call :Ramdisk
call :WIM_bootwim
call :BootC
call :GRUB4DOS
call :SYSLINUX
call :ISOLINUX
call :XPPE
call :WIM_w7x86
call :WIM_w7x64
call :WIM_w8x86
call :WIM_w8x64
call :WIM_DART_w7x86
call :WIM_DART_w7x64
call :WIM_DART_w8x86
call :WIM_DART_w8x64
call :WIM_DART_wVx86
call :WIM_DART_wVx64
call :XPHDD
call :XPNORMAL
call :XPADMIN
call :XPES
rem call :BootC
rem call :BootD
rem call :BootE
rem call :BootF
rem call :BootG
rem call :BootH
rem call :W2Go
rem call :VHDDVD
rem call :VHDHDD

call :DONE
goto :StartBCD



:CREATECUSTOMDVDEFI
call :CREATEBCD
call :Ramdisk
call :WIM_bootwim
call :BootC
rem call :GRUB4DOS
rem call :SYSLINUX
rem call :ISOLINUX
rem call :XPPE
rem call :WIM_w7x86
call :WIM_w7x64
rem call :WIM_w8x86
call :WIM_w8x64
rem call :WIM_DART_w7x86
call :WIM_DART_w7x64
rem call :WIM_DART_w8x86
call :WIM_DART_w8x64
rem call :WIM_DART_wVx86
call :WIM_DART_wVx64
rem call :XPHDD
rem call :XPNORMAL
rem call :XPADMIN
rem call :XPES
rem call :BootC
rem call :BootD
rem call :BootE
rem call :BootF
rem call :BootG
rem call :BootH
rem call :W2Go
rem call :VHDDVD
rem call :VHDHDD
call :DONE
goto :StartBCD



:CREATECUSTOMHDD
rem call :CREATEBCD
rem call :BootC
rem call :RamdiskHDD
call :WIM_bootwim
call :GRUB4DOS
call :SYSLINUX
rem call :VHDHDDw7x86
rem call :VHDHDDw7x64
call :VHDHDDw8x86
rem call :VHDHDDw8x64
rem call :XPPE
call :WIM_w7x86
call :WIM_w7x64
call :WIM_w8x86
call :WIM_w8x64
rem call :WIM_DART_w7x86
rem call :WIM_DART_w7x64
rem call :WIM_DART_w8x86
call :WIM_DART_w8x64
rem call :WIM_DART_wVx86
rem call :WIM_DART_wVx64
rem call :XPHDD
rem call :XPNORMAL
rem call :XPADMIN
rem call :XPES
rem call :BootD
rem call :BootE
rem call :BootF
rem call :BootG
rem call :BootH
rem call :W2Go
rem call :VHDDVD
rem call :VHDHDD
%BCDEDIT% %STORE% /default {current}
call :DONE
goto :StartBCD


:CREATECUSTOMHDDEFI
rem call :CREATEBCD
rem call :RamdiskHDD
call :WIM_bootwim
rem call :BootC
rem call :GRUB4DOS
rem call :SYSLINUX
rem call :ISOLINUX
rem call :XPPE
call :WIM_w7x86
call :WIM_w7x64
call :WIM_w8x86
call :WIM_w8x64
rem call :WIM_DART_w7x86
rem call :WIM_DART_w7x64
rem call :WIM_DART_w8x86
rem call :WIM_DART_w8x64
rem call :WIM_DART_wVx86
rem call :WIM_DART_wVx64
rem call :XPHDD
rem call :XPNORMAL
rem call :XPADMIN
rem call :XPES
rem call :BootD
rem call :BootE
rem call :BootF
rem call :BootG
rem call :BootH
rem call :W2Go
rem call :VHDDVD
rem call :VHDHDD
%BCDEDIT% %STORE% /default {current}
call :DONE
goto :StartBCD




:CREATEBCD
Echo Create BCD
rem %BCDEDIT% /createstore %BCD%

Echo Create BootManager
%BCDEDIT% %STORE% /create {bootmgr}
%BCDEDIT% %STORE% /set {bootmgr} description "Windows Boot Manager"
%BCDEDIT% %STORE% /set {bootmgr} device %partition%
%BCDEDIT% %STORE% /set {bootmgr} locale en-US
%BCDEDIT% %STORE% /set {bootmgr} nointegritychecks YES
%BCDEDIT% %STORE% /set {bootmgr} DisplayBootMenu True
%BCDEDIT% %STORE% /set {bootmgr} timeout 10


Echo Bad memory
%BCDEDIT% %STORE% /create {badmemory}

Echo EMS
%BCDEDIT% %STORE% /create {emssettings}
rem text
%BCDEDIT% %STORE% /set {emssettings} bootems "Yes"
rem UI
rem %BCDEDIT% %STORE% /set {emssettings} bootems "No"

Echo Debug
%BCDEDIT% %STORE% /create {dbgsettings}
%BCDEDIT% %STORE% /dbgsettings SERIAL DEBUGPORT:1 BAUDRATE:115200

Echo Hypervisor
%BCDEDIT% %STORE% /create {hypervisorsettings}
%BCDEDIT% %STORE% /hypervisorsettings SERIAL DEBUGPORT:1 BAUDRATE:115200

Echo Global settings
%BCDEDIT% %STORE% /create {globalsettings}
%BCDEDIT% %STORE% /set {globalsettings} INHERIT {dbgsettings} {emssettings} {badmemory}
%BCDEDIT% %STORE% /set {bootmgr} INHERIT {globalsettings}

Echo Bootloader settings
%BCDEDIT% %STORE% /create {bootloadersettings}
%BCDEDIT% %STORE% /set {bootloadersettings} INHERIT {globalsettings} {hypervisorsettings}

Echo Resume
rem %BCDEDIT% %STORE% /create {resumeloadersettings}
rem %BCDEDIT% %STORE% /set {resumeloadersettings} INHERIT {globalsettings}

Echo Memtest
%BCDEDIT% %STORE% /create {memdiag}
%BCDEDIT% %STORE% /set {memdiag} description "Windows Memory Diagnostic"
rem %BCDEDIT% %STORE% /set {memdiag} device partition=\Device\HarddiskVolume1
%BCDEDIT% %STORE% /set {memdiag} device %partition%
%BCDEDIT% %STORE% /set {memdiag} path \boot\memtest.exe
%BCDEDIT% %STORE% /set {memdiag} locale en-US
%BCDEDIT% %STORE% /set {memdiag} inherit {globalsettings}
rem %BCDEDIT% %STORE% /set {memdiag} badmemoryaccess Yes
%BCDEDIT% %STORE% /toolsdisplayorder {memdiag}
goto :eof



:Ramdisk
Echo Ramdisk settings
rem %BCDEDIT% /createstore %STORE%
%BCDEDIT% %STORE% /create {ramdiskoptions}
%BCDEDIT% %STORE% /set {ramdiskoptions} ramdisksdidevice %partition%
%BCDEDIT% %STORE% /set {ramdiskoptions} ramdisksdipath \boot\boot.sdi
goto :eof


:RamdiskHDD
Echo Ramdisk settings
rem %BCDEDIT% /createstore %STORE%
%BCDEDIT% %STORE% /create {ramdiskoptions}
%BCDEDIT% %STORE% /set {ramdiskoptions} ramdisksdidevice %partition%
%BCDEDIT% %STORE% /set {ramdiskoptions} ramdisksdipath \Windows\system32\boot\boot.sdi
goto :eof


:GRUB4DOS
echo GRUB4DOS
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Grub4dos  (%partition%\boot\grub\grldr)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\grub\grldr
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:GRUB2
echo GRUB2
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Grub2  (%partition%\boot\grub\g2ldr.mbr)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\grub\g2ldr.mbr
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:BURG
echo BURG
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Burg  (%partition%\boot\burg\g2ldr)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\burg\g2ldr
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:SYSLINUX
echo SYSLINUX
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Syslinux  (%partition%\boot\syslinux\syslinux.bin) (USB)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\syslinux\syslinux.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:ISOLINUX
echo ISOLINUX
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "Isolinux  (%partition%\boot\isolinux\isolinux.bin) (CD\DVD)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\isolinux\isolinux.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:XPPE
echo XP PE
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "WinXP Mini PE (%partition%\boot\XP.wim)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\XP.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:XPWIM
Echo XP.wim
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid%  DEVICE ramdisk=[boot]\boot\XP.wim,{ramdiskoptions}
%BCDEDIT% %STORE% /set %guid%  OSDEVICE ramdisk=[boot]\boot\XP.wim,{ramdiskoptions}
%BCDEDIT% %STORE% /set %guid%  systemroot \windows
%BCDEDIT% %STORE% /set %guid%  winpe yes
%BCDEDIT% %STORE% /set %guid%  nx optin
%BCDEDIT% %STORE% /set %guid%  detecthal yes
%BCDEDIT% %STORE% /set %guid%  path \Windows\system32\winload.exe
rem %BCDEDIT% %STORE% /set %guid%  ems "yes"
rem %BCDEDIT% %STORE% /set %guid%  INHERIT {bootloadersettings}
%BCDEDIT% %STORE% /set %guid% description "Live XP %choice% (%partition%\boot\XP.wim)"
%BCDEDIT% %STORE% /ems %guid% on
%BCDEDIT% %STORE% /bootems %guid% on
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy legacy
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy standard
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:XPHDD
echo XP HDD
%BCDEDIT% %STORE% /create {ntldr} /d "WinXP ntldr"
%BCDEDIT% %STORE% /set {ntldr} device partition=%partition%
%BCDEDIT% %STORE% /set {ntldr} path \ntldr
rem %BCDEDIT% %STORE% /set {bootmgr} displaybootmenu yes
%BCDEDIT% %STORE% /displayorder {ntldr} /addlast
goto :eof


:XPNORMAL
echo XP normal
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "WinXP Normal Setup (i386\SETUPLDR.bin) (CD\DVD)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \I386\SETUPLDR.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:XPADMIN
echo XP admin
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "WinXP Admin (i386\SETUPLDU.bin) (CD\DVD)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \I386\SETUPLDU.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:XPES
echo XP Enter settings
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "WinXP Enter Settings (i386\SETUPLDE.bin) (CD\DVD)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \I386\SETUPLDE.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:W2Go
echo Windows to go
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% path \Windows\system32\%winload%
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "Windows to Go [boot] (Win8 Enterprise)"
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% osdevice %partition%
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:VHDDVD
echo VHDDVD
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\%VHDname%
%BCDEDIT% %STORE% /set %guid% path \Windows\system32\%winload%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\%VHDname%
%BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "VHD (%Path%\%VHDname%)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:VHDHDD
echo VHDHDD
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\%VHDname%
%BCDEDIT% %STORE% /set %guid% path \Windows\system32\%winload%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\%VHDname%
%BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "VHD (%Path%\%VHDname%)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:VHDHDDw7x86
echo VHDHDDw7x86
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\w7x86.vhd
%BCDEDIT% %STORE% /set %guid% path \Windows\system32\%winload%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\w7x86.vhd
%BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "w7x86 VHD (%Path%\w7x86.vhd)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:VHDHDDw7x64
echo VHDHDDw7x64
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\w7x64.vhd
%BCDEDIT% %STORE% /set %guid% path \Windows\system32\%winload%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\w7x64.vhd
%BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "w7x64 VHD (%Path%\w7x64.vhd)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:VHDHDDw8x86
echo VHDHDDw8x86
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\w8x86.vhd
%BCDEDIT% %STORE% /set %guid% path \Windows\system32\%winload%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\w8x86.vhd
%BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "w8x86 VHD (%Path%\w8x86.vhd)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:VHDHDDw8x64
echo VHDHDDw8x64
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device vhd=%Path%\w8x64.vhd
%BCDEDIT% %STORE% /set %guid% path \Windows\system32\%winload%
%BCDEDIT% %STORE% /set %guid% osdevice vhd=%Path%\w8x64.vhd
%BCDEDIT% %STORE% /set %guid% detecthal Yes
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "w8x64 VHD (%Path%\w8x64.vhd)"
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:pxelinux
echo pxelinux
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "pxelinux  (boot\syslinux\pxelinux.bin)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\syslinux\pxelinux.bin
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:pxeWindows
echo pxeWindows
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /d "pxeWindows  (boot\bootpxe\pxeboot.n12)" /application bootsector') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device %partition%
%BCDEDIT% %STORE% /set %guid% path \boot\bootpxe\pxeboot.n12
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


:BootC
echo Windows c:
set Drive=C:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootD
echo Windows D:
set Drive=D:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootE
echo Windows E:
set Drive=E:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootF
echo Windows F:
set Drive=F:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootG
echo Windows G:
set Drive=G:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootH
echo Windows H:
set Drive=H:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootI
echo Windows I:
set Drive=I:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootJ
echo Windows J:
set Drive=J:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BootK
echo Windows K:
set Drive=K:
set bootmenupolicy=standard
rem set bootmenupolicy=legacy
goto :BOOT
:BOOT
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid% device partition=%Drive%
%BCDEDIT% %STORE% /set %guid% path \Windows\system32\%winload%
%BCDEDIT% %STORE% /set %guid% osdevice partition=%Drive%
%BCDEDIT% %STORE% /set %guid% systemroot \Windows
%BCDEDIT% %STORE% /set %guid% description "Windows %Drive%"
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy %bootmenupolicy%
rem %BCDEDIT% %STORE% /set %guid%  ems "yes"
rem %BCDEDIT% %STORE% /ems %guid% on
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof



:WIM_bootwim
Echo boot.wim
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /default %guid% 
%BCDEDIT% %STORE% /set %guid%  DEVICE ramdisk=%path%\boot.wim,{ramdiskoptions}
%BCDEDIT% %STORE% /set %guid%  OSDEVICE ramdisk=%path%\boot.wim,{ramdiskoptions}
%BCDEDIT% %STORE% /set %guid%  systemroot \windows
%BCDEDIT% %STORE% /set %guid%  winpe yes
%BCDEDIT% %STORE% /set %guid%  nx optin
%BCDEDIT% %STORE% /set %guid%  detecthal yes
%BCDEDIT% %STORE% /set %guid%  locale en-US
%BCDEDIT% %STORE% /set %guid%  path \windows\system32\boot\%winload%
%BCDEDIT% %STORE% /set %guid%  ems "yes"
%BCDEDIT% %STORE% /set %guid%  INHERIT {bootloadersettings}
%BCDEDIT% %STORE% /set %guid% description "Windows Setup %choice% (%path%\boot.wim)"
%BCDEDIT% %STORE% /ems %guid% on
%BCDEDIT% %STORE% /bootems %guid% on
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy legacy
%BCDEDIT% %STORE% /set %guid% bootmenupolicy standard
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof




:WIM_DART_w7x86
echo Win DART 7 %choice% x86
set pename="Win7 %choice% Setup\DART x86 (%path%\w7x86\boot.wim)"
set filena=%Path%\w7x86\boot.wim
goto :WIMAll
:WIM_DART_w7x64
echo Win DART 7 %choice% x64
set pename="Win7 %choice% Setup\DART x64 (%path%\w7x64\boot.wim)"
set filena=%Path%\w7x64\boot.wim
goto :WIMAll
:WIM_DART_w8x86
echo Win DART 8 %choice% x86
set pename="Win8 %choice% Setup\DART x86 (%path%\w8x86\boot.wim)"
set filena=%Path%\w8x86\boot.wim
goto :WIMAll
:WIM_DART_w8x64
echo Win DART 8 %choice% x64
set pename="Win8 %choice% Setup\DART x64 (%path%\w8x64\boot.wim)"
set filena=%Path%\w8x64\boot.wim
goto :WIMAll
:WIM_DART_wVx86
echo Win DART Vista %choice% x86
set pename="Vista %choice% Setup\DART x86 (%path%\wVx86\boot.wim)"
set filena=%Path%\wVx86\boot.wim
goto :WIMAll
:WIM_DART_wVx64
echo Win DART Vista x64
set pename="Vista %choice% Setup\DART x64 (%path%\wVx64\boot.wim)"
set filena=%Path%\wVx64\boot.wim
goto :WIMAll
:WIM_w7x86
echo WinPE 7 %choice%
set pename="WinPE 7 %choice% x86 (%path%\w7x86.wim)"
set filena=%Path%\w7x86.wim
goto :WIMAll
:WIM_w7x64
echo WinPE 7 %choice% x64
set pename="WinPE 7 %choice% x64 (%path%\w7x64.wim)"
set filena=%Path%\w7x64.wim
goto :WIMAll
:WIM_w8x86
echo WinPE 8 %choice%
set pename="WinPE 8 %choice% x86 (%path%\w8x86.wim)"
set filena=%Path%\w8x86.wim
goto :WIMAll
:WIM_w8x64
echo WinPE 8 %choice% x64
set pename="WinPE 8 %choice% x64 (%path%\w8x64.wim)"
set filena=%Path%\w8x64.wim
goto :WIMAll
:WIMAll
for /f "tokens=3" %%A in ('%BCDEDIT% %STORE% /create /application osloader') do set guid=%%A
%BCDEDIT% %STORE% /set %guid%  DEVICE ramdisk=%filena%,{ramdiskoptions}
%BCDEDIT% %STORE% /set %guid%  OSDEVICE ramdisk=%filena%,{ramdiskoptions}
%BCDEDIT% %STORE% /set %guid%  systemroot \windows
%BCDEDIT% %STORE% /set %guid%  winpe yes
%BCDEDIT% %STORE% /set %guid%  nx optin
%BCDEDIT% %STORE% /set %guid%  detecthal yes
%BCDEDIT% %STORE% /set %guid%  locale en-US
%BCDEDIT% %STORE% /set %guid%  path \windows\system32\boot\%winload%
%BCDEDIT% %STORE% /set %guid%  ems "yes"
%BCDEDIT% %STORE% /set %guid%  INHERIT {bootloadersettings}
%BCDEDIT% %STORE% /set %guid% description %pename%
rem %BCDEDIT% %STORE% /ems %guid% on
rem %BCDEDIT% %STORE% /bootems %guid% on
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy legacy
rem %BCDEDIT% %STORE% /set %guid% bootmenupolicy standard
%BCDEDIT% %STORE% /displayorder %guid% /addlast
goto :eof


Re: How to fix "Flag 9" in boot.wim when using upgrades
« Reply #3 on: February 07, 2013, 10:06:58 PM »

JFX

  • Moderator, Code Baker
  • Chef
  • *****
  • Date Registered: Dec 2010
  • Posts: 489
Interesting that setting the Flag works for this.  :confused:

I had supposed there would be a problem as "our" WinPE has systemroot \Windows just like the windows to install.
The original boot.wim image 1 (with flag 9) had systemroot \$windows.~bt\Windows,
so it can coexist at the same time on the same partition during setup.
« Last Edit: February 07, 2013, 10:07:31 PM by JFX »

Re: How to fix "Flag 9" in boot.wim when using upgrades
« Reply #4 on: February 09, 2013, 04:28:25 PM »

halikus

  • Jr. Chef
  • **
  • Date Registered: Feb 2013
  • Posts: 28
Hmm, i found this also, and im going to test and see if setup will work.

Flags are used only by Windows Setup. A flag on a Volume Image of 2 means a Volume Image contains Windows PE and setup. A flag of 9 means it contains just Windows PE. Any other flag or the lack of a flag means that the image will not and cannot be used by setup. You should note that you can set flags on an image after it has been captured by using ImageX to modify them.

 

Powered by EzPortal