OEM Recovery Partition Creator for Windows

Discussion in 'MDL Projects and Applications' started by AnarethoS, Sep 11, 2010.

  1. The_Guardian

    The_Guardian Contributor

    May 7, 2012
    2,054
    6,803
    90
    Think AnarethoS will have to look into this. I am at a loss, sorry. :(
     
  2. thebig123

    thebig123 MDL Novice

    Dec 5, 2013
    1
    0
    0
    cerberus8855 and RJOliver:


    I also had the same issue RJOliver is experiencing with Win 8.1. RE would not enable on my UEFI machine and gave that exact error about NTFS.


    I think the issue is the UEFI type ID for the recovery partition being set to: de94bba4-06d1-4d40-a16a-bfd50179d6ac


    This is set in the Autounattend.xml when initially installing Windows 8.1


    I kinda made a solution/fix. I removed that Set ID line for the recovery partition in Autounatted.xml, so it's just a regular partition (not hidden). Then when I loaded into Windows for the first time, the RE was enabled successfully. However, the recovery partition was not hidden. I wanted it to be hidden, just like it was in Windows 8.


    So my work around for that was adding a setupcomplete command when Windows loads up for the first time. You can set the recovery partition ID to de94bba4-06d1-4d40-a16a-bfd50179d6ac


    This solution seems to work for me, however it's not ideal. I'm not sure if this is a Windows 8.1 bug or what.
     
  3. The_Guardian

    The_Guardian Contributor

    May 7, 2012
    2,054
    6,803
    90
    I am testing this now in vmware to see my results. This is on a regular mbr sata hdd. I cant test ssd's.

    -captured image without issues
    -when at desktop for end user (not audit mode) no errors of any kind popup
    -recovery partition is hidden from the This PC window (it will show under defragment service and disk management but this is all normal)
    -creating dvd iso without issues
    -the created recovery dvd installed partitions, recovery and windows installation without error's

    I had absolutely no issues what so ever in vmware but only made image of just a bare os...no drivers or any software installed (image was a little over 3 gigs). I dont know about doing 3+ dvd recovery media for it is late and I didnt want to be up all night testing the multi dvd recovery images. Hope everyone understands. Good night to all.
     
  4. random566

    random566 MDL Novice

    Mar 27, 2008
    5
    1
    0
    i also had the problem of recovery environment not enabled on a mbr pc with 8.1 x64.
    tried with "reagentc.exe /enable" and had the message "REAGENTC.EXE: Winodws RE must be installed on a simple volume formatted using NTFS"
    then, from command prompt as administrator, i tried:
    diskpart
    select disk 0
    select partition 1
    set id=07
    exit
    and after this, retried "regentc.exe /enable"
    at this time the respose was command successful.
    after this, for setting the correct id for the recovery partition, i used
    diskpart
    select disk 0
    select partition 1
    set id=27
    exit
    after all that, everything worked correctly.
    sorry for my bad english and thanks to all.
     
  5. The_Guardian

    The_Guardian Contributor

    May 7, 2012
    2,054
    6,803
    90
    Seems like the id is the issue from the looks of it...vmware is different from a real machine I know. Win 8.1 is picky with this and AnarethoS needs to look at this thread and see if he can come up with a solution. I am at a loss for I cant reproduce in vmware at all. This can only be tested on a real win8 or 8.1 machine in order to troubleshoot it. Until this is resolved I will wait to update my machine to win 8.1....was going to do it today but I think it is best to wait.

    Update: I sent a pm to him so hopefully he will look at these posts and find a solution.

    Just to recap...
    -problem with third dvd not being created (second dvd asks for 3rd dvd but there was not one created).
    -recovery id isnt being accepted for win 8.1 recovery partition.

    I did notice something...in autounattended.xml the recovery id is set to <TypeID>0x27</TypeID> what if you just put 27 instead of the 0x27? Would that possibly work? If someone could try for the above solution random put was just the 27. Might be the issue for this in win 8.1....just guessing though.
     
  6. AnarethoS

    AnarethoS MDL Expert

    Jul 31, 2009
    1,297
    1,587
    60
    SetupComplete.cmd will not run on OEM computer. FirstLogon.cmd is a script called by my Sysprep.XML file and will run on anything.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. AnarethoS

    AnarethoS MDL Expert

    Jul 31, 2009
    1,297
    1,587
    60
    There is so much post that I missed (sorry, my girlfriend is 37 weeks pregnant and we are completing the preparation for our future daughter).

    Can you make a little recap of you problem?

    For what I understand, WinRE seems not to work and complain about not being in NTFS drive.

    1) Are you using MBR/BIOS or GPT/UEFI version?
    2) Using WIM on first partition or WIM on last partition?
    3) Do you have more that 1 fixed drive in your computer?
    4) Are you using a drive with HDD+FLASH on it?
    5) Did you have modified any of the comfiguration file?
    6) Are you using an original untouched DVD (or USB made form such DVD) to install Windows?
    7) Have you disabled SecureBoot ?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  8. AnarethoS

    AnarethoS MDL Expert

    Jul 31, 2009
    1,297
    1,587
    60
    This is not a supported solution with my script neighter is from Microsoft, although I saw it use on my Asus T100 32gb notebook (WIM file on a secondary read-only drive).

    You will have to o everything by hand (partitioning, capturing and configuring the environment). Or, you can use the option with the WIM on the last partition, create the recovery drive and then accept to delete the recovery partition.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. AnarethoS

    AnarethoS MDL Expert

    Jul 31, 2009
    1,297
    1,587
    60
    What was the name of the Empty TXT file? This is not supposed to happen.....
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. The_Guardian

    The_Guardian Contributor

    May 7, 2012
    2,054
    6,803
    90
    Congrats! You will make a great father.
     
  11. RJOliver

    RJOliver MDL Novice

    Nov 27, 2013
    16
    0
    0

    So it sounds like RANDOM566 had a solution one page back but i have not tested it on my systems yet.

    but to answer your questions :

    I used the MBR Version
    WIM on the first partition
    Only 1 drive on all systems (8.0 with installer works 100%)
    No on the HDD+Flash
    All your base files nothing modded.
    win 8.1 ISO untouched.
    secureboot is disabled.

    Thanks for your time and a GREAT installer.
     
  12. AnarethoS

    AnarethoS MDL Expert

    Jul 31, 2009
    1,297
    1,587
    60
    When Windows has completed installing and you are in AUDIT mode, can you do me a printout of the REAGENTC /INFO command?

    I would like to see if Windows has correctly installed the Recovery Environment on the recovery partition.....
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. AnarethoS

    AnarethoS MDL Expert

    Jul 31, 2009
    1,297
    1,587
    60
    #2513 AnarethoS, Dec 5, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
    I have made some correction to the Windows 8.1 installation script.

    The new script should help the following :
    - Recovery Environment not activated after capture


    Install - Windows 8.1.cmd for WIM on last partition
    Code:
    @Echo Off
    IF NOT EXIST "%CD%\CaptureImage\Capture\SettingsRE.txt" EXIT
    IF NOT EXIST "%CD%\SettingsRE.txt" EXIT
    IF NOT EXIST "%CD%\RecoveryFiles\ResetConfig.xml" EXIT
    IF NOT EXIST "%CD%\RecoveryFiles\ResetPartitions.txt" EXIT
    IF NOT EXIST "%CD%\Sysprep.xml" EXIT
    IF NOT EXIST C:\Windows\System32\Sysprep\Sysprep.exe EXIT
    REAGENTC /DISABLE
    
    CLS
    TITLE Capture Windows 8 Image
    TASKKILL /IM SYSPREP.EXE /F
    
    
    ECHO ==============================================
    ECHO Loading Settings
    ECHO ==============================================
    FOR /F "delims=; tokens=1" %%I in (SettingsRE.txt) DO SET %%I
    
    ECHO ==============================================
    ECHO Creating recovery partition / resize
    ECHO ==============================================
    ECHO SELECT DISK %DISKID% >C:\Hdd.txt
    ECHO SELECT PARTITION %WINDOWSPART% >>C:\Hdd.txt
    ECHO SHRINK MINIMUM=%IMAGESIZE% DESIRED=%IMAGESIZE% >>C:\Hdd.txt
    ECHO CREATE PARTITION PRIMARY >>C:\Hdd.txt
    ECHO SELECT PARTITION %IMAGEPART% >>C:\Hdd.txt
    ECHO FORMAT FS=NTFS QUICK LABEL=RECIMAGE >>C:\Hdd.txt
    ECHO SELECT PARTITION %IMAGEPART% >>C:\Hdd.txt
    ECHO SET ID=27 NOERR >>C:\Hdd.txt
    ECHO SELECT PARTITION %IMAGEPART% >>C:\Hdd.txt
    ECHO SET ID="de94bba4-06d1-4d40-a16a-bfd50179d6ac" NOERR >>C:\Hdd.txt
    DISKPART /S C:\Hdd.txt
    DEL C:\Hdd.txt
    
    
    ECHO ==============================================
    ECHO MOUNTING RECOVERY PARTITION
    ECHO ==============================================
    ECHO SELECT DISK %DISKID% >C:\Hdd.txt
    ECHO SELECT PARTITION %RECOVERYPART% >>C:\Hdd.txt
    ECHO ASSIGN LETTER=%RECOVERYLETTER% >>C:\Hdd.txt
    ECHO SELECT PARTITION %IMAGEPART% >>C:\Hdd.txt
    ECHO ASSIGN LETTER=%IMAGELETTER% >>C:\Hdd.txt
    DISKPART /S C:\Hdd.txt
    DEL C:\Hdd.txt
    IF NOT EXIST %RECOVERYLETTER%:\ GOTO ERRORNOREC
    IF NOT EXIST %IMAGELETTER%:\ GOTO ERRORNOREC
    
    
    ECHO ==============================================
    ECHO BACKUP ORIGINAL WINDOWSRE
    ECHO ==============================================
    ATTRIB -S -R -H C:\Windows\System32\Recovery\*.* /S
    IF NOT EXIST C:\Windows\System32\Recovery\Winre.Wim GOTO ERRORNOWINRE
    IF NOT EXIST C:\Windows\System32\Recovery\Backup MD C:\Windows\System32\Recovery\Backup
    IF NOT EXIST C:\Windows\System32\Recovery\Backup\ReAgent.xml COPY C:\Windows\System32\Recovery\ReAgent.xml C:\Windows\System32\Recovery\Backup\ReAgent.xml
    IF NOT EXIST C:\Windows\System32\Recovery\Backup\WinRE.Wim COPY C:\Windows\System32\Recovery\WinRE.Wim C:\Windows\System32\Recovery\Backup\WinRE.Wim
    
    
    ECHO ==============================================
    ECHO COPYING WINDOWSRE
    ECHO ==============================================
    MD %RECOVERYLETTER%:\Capture
    MD %RECOVERYLETTER%:\Recovery\WindowsRE
    MD %IMAGELETTER%:\RecoveryImage
    COPY C:\Windows\System32\Recovery\WinRE.Wim %RECOVERYLETTER%:\Recovery\WindowsRE\WinRE.Wim
    COPY C:\Windows\System32\Recovery\WinRE.Wim %RECOVERYLETTER%:\Capture\WinRE.Wim
    COPY C:\Windows\Boot\DVD\PCAT\Boot.Sdi %RECOVERYLETTER%:\Recovery\WindowsRE\Boot.Sdi
    COPY C:\Windows\Boot\DVD\PCAT\Boot.Sdi %RECOVERYLETTER%:\Capture\Boot.Sdi
    COPY ".\RecoveryFiles\*.*" %IMAGELETTER%:\RecoveryImage
    
    
    ECHO ==============================================
    ECHO Configuring FirstLogon.cmd
    ECHO ==============================================
    MD C:\Windows\Setup\Scripts
    ECHO SELECT DISK %DISKID% >C:\Windows\Setup\Scripts\Hdd.Txt
    ECHO SELECT PARTITION %RECOVERYPART% >>C:\Windows\Setup\Scripts\Hdd.Txt
    ECHO REMOVE >>C:\Windows\Setup\Scripts\Hdd.Txt
    ECHO SELECT PARTITION %IMAGEPART% >>C:\Windows\Setup\Scripts\Hdd.Txt
    ECHO REMOVE >>C:\Windows\Setup\Scripts\Hdd.Txt
    IF EXIST C:\Windows\Setup\Scripts\FirstLogon.cmd (
    REN C:\Windows\Setup\Scripts\FirstLogon.cmd FirstLogon.Sav
    ECHO DISKPART /S C:\Windows\Setup\Scripts\Hdd.Txt >C:\Windows\Setup\Scripts\FirstLogon.cmd
    TYPE C:\Windows\Setup\Scripts\FirstLogon.Sav >> C:\Windows\Setup\Scripts\FirstLogon.cmd 
    DEL C:\Windows\Setup\Scripts\FirstLogon.Sav)
    IF NOT EXIST C:\Windows\Setup\Scripts\FirstLogon.cmd ECHO DISKPART /S C:\Windows\Setup\Scripts\Hdd.Txt >C:\Windows\Setup\Scripts\FirstLogon.cmd
    IF EXIST C:\Windows\Setup\Scripts\FirstLogon.cmd (
    REN C:\Windows\Setup\Scripts\FirstLogon.cmd FirstLogon.Sav
    ECHO ReAgentc.exe /Enable >C:\Windows\Setup\Scripts\FirstLogon.cmd
    TYPE C:\Windows\Setup\Scripts\FirstLogon.Sav >> C:\Windows\Setup\Scripts\FirstLogon.cmd 
    DEL C:\Windows\Setup\Scripts\FirstLogon.Sav)
    IF NOT EXIST C:\Windows\Setup\Scripts\FirstLogon.cmd ECHO ReAgentc.exe /Enable >C:\Windows\Setup\Scripts\FirstLogon.cmd
    IF EXIST C:\Windows\Setup\Scripts\FirstLogon.cmd (
    REN C:\Windows\Setup\Scripts\FirstLogon.cmd FirstLogon.Sav
    ECHO ReAgentc.exe /SetBootShellLink /ConfigFile C:\Windows\System32\RecoveryTools\WinRE.xml >C:\Windows\Setup\Scripts\FirstLogon.cmd
    TYPE C:\Windows\Setup\Scripts\FirstLogon.Sav >> C:\Windows\Setup\Scripts\FirstLogon.cmd 
    DEL C:\Windows\Setup\Scripts\FirstLogon.Sav)
    IF NOT EXIST C:\Windows\Setup\Scripts\FirstLogon.cmd ECHO ReAgentc.exe /SetBootShellLink /ConfigFile C:\Windows\System32\RecoveryTools\WinRE.xml >C:\Windows\Setup\Scripts\FirstLogon.cmd
    
    
    
    ECHO ==============================================
    ECHO MODIFYING CAPTURE IMAGE
    ECHO ==============================================
    MD %TMP%\WinRE
    DISM /Mount-Wim /Index:1 /WimFile:%RECOVERYLETTER%:\Capture\WinRE.Wim /MountDir:%TMP%\WinRE
    ATTRIB -S -R -H %TMP%\WinRE\Windows\System32\WINPESHL.INI
    DEL %TMP%\WinRE\Windows\System32\WINPESHL.INI
    XCOPY /SEVHKY .\CaptureImage\*.* %TMP%\WinRE\
    DISM /UnMount-Wim /MountDir:%TMP%\WinRE /commit
    
    
    ECHO ==============================================
    ECHO MODIFYING RECOVERY TOOLS
    ECHO ==============================================
    MD %TMP%\WinRE
    DISM /Mount-Wim /Index:1 /WimFile:%RECOVERYLETTER%:\Recovery\WindowsRE\WinRE.Wim /MountDir:%TMP%\WinRE
    XCOPY /SEVHKY .\WinRE%PROCESSOR_ARCHITECTURE%\*.* %TMP%\WinRE\
    DISM /UnMount-Wim /MountDir:%TMP%\WinRE /commit
    
    
    ECHO ==============================================
    ECHO SYSPREPING THE COMPUTER
    ECHO ==============================================
    XCOPY .\Files\*.* /SEVHKY C:\
    REAGENTC /ENABLE
    START /WAIT C:\Windows\System32\Sysprep\SysPrep.exe /generalize /oobe /quit /unattend:SysPrep.Xml
    START /WAIT CreateShortcut "C:\Windows\System32\RecoveryTools\Recovery%PROCESSOR_ARCHITECTURE%.EXE" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Recovery Tools.lnk"
    
    
    ECHO ==============================================
    ECHO ADDING CAPTURE IMAGE
    ECHO ==============================================
    FOR /F "delims={} tokens=2" %%I IN ('BCDEDIT.EXE /create /application OSLOADER /d Capture') DO SET OSGUID=%%I
    FOR /F "delims={} tokens=2" %%I IN ('BCDEDIT.EXE /create /device /d Capture') DO SET RAMGUID=%%I
    SET OSGUID={%OSGUID%}
    SET RAMGUID={%RAMGUID%}
    bcdedit /set %OSGUID% device ramdisk=[%RECOVERYLETTER%:]\Capture\WinRe.Wim,%RAMGUID%
    bcdedit /set %OSGUID% osdevice ramdisk=[%RECOVERYLETTER%:]\Capture\WinRe.Wim,%RAMGUID%
    bcdedit /set %OSGUID% path \windows\system32\boot\%WINLOAD%
    bcdedit /set %OSGUID% locale %LANG%
    bcdedit /set %OSGUID% inherit {bootloadersettings}
    bcdedit /set %OSGUID% systemroot \windows
    bcdedit /set %OSGUID% detecthal Yes
    bcdedit /set %OSGUID% winpe Yes
    bcdedit /set %OSGUID% ems No
    bcdedit /set %RAMGUID% ramdisksdidevice partition=%RECOVERYLETTER%:
    bcdedit /set %RAMGUID% ramdisksdipath \Capture\BOOT.SDI
    bcdedit /set {bootmgr} displayorder %OSGUID% /addlast
    bcdedit /set {bootmgr} locale %LANG%
    bcdedit /set {current} locale %LANG%
    bcdedit /delete {current}
    
    
    ECHO ==============================================
    ECHO Rebooting the computer
    ECHO ==============================================
    SHUTDOWN -R -F -T 15
    GOTO QUIT
    
    :ERRORNOREC
    CLS
    ECHO *******************************************
    ECHO Recovery partition not found.
    ECHO *******************************************
    ECHO Please check settings and try again.
    ECHO *******************************************
    PAUSE
    GOTO QUIT
    
    
    :ERRORNOWINRE
    CLS
    ECHO *******************************************
    ECHO WinRE.Wim not found.
    ECHO *******************************************
    ECHO Please install this software only on 
    ECHO computer where the AutoUnattend.XMl was
    ECHO used during the installation process.
    ECHO Manually switching to AUDIT mode during
    ECHO OOBE process is not supported under
    ECHO Windows 8.
    ECHO *******************************************
    PAUSE
    GOTO QUIT
    
    
    :QUIT
    

    Install - Windows 8.1.cmd for WIM on first partition
    Code:
    @Echo Off
    IF NOT EXIST "%CD%\CaptureImage\Capture\SettingsRE.txt" EXIT
    IF NOT EXIST "%CD%\SettingsRE.txt" EXIT
    IF NOT EXIST "%CD%\RecoveryFiles\ResetConfig.xml" EXIT
    IF NOT EXIST "%CD%\RecoveryFiles\ResetPartitions.txt" EXIT
    IF NOT EXIST "%CD%\Sysprep.xml" EXIT
    IF NOT EXIST C:\Windows\System32\Sysprep\Sysprep.exe EXIT
    REAGENTC /DISABLE
    
    CLS
    TITLE Capture Windows 8 Image
    TASKKILL /IM SYSPREP.EXE /F
    
    ECHO ==============================================
    ECHO Loading Settings
    ECHO ==============================================
    FOR /F "delims=; tokens=1" %%I in (SettingsRE.txt) DO SET %%I
    
    
    ECHO ==============================================
    ECHO MOUNTING RECOVERY PARTITION
    ECHO ==============================================
    ECHO SELECT DISK %DISKID% >C:\Hdd.txt
    ECHO SELECT PARTITION %RECOVERYPART% >>C:\Hdd.txt
    ECHO ASSIGN LETTER=%RECOVERYLETTER% >>C:\Hdd.txt
    DISKPART /S C:\Hdd.txt
    DEL C:\Hdd.txt
    IF NOT EXIST %RECOVERYLETTER%:\ GOTO ERRORNOREC
    
    
    ECHO ==============================================
    ECHO BACKUP ORIGINAL WINDOWSRE
    ECHO ==============================================
    ATTRIB -S -R -H C:\Windows\System32\Recovery\*.* /S
    IF NOT EXIST C:\Windows\System32\Recovery\Winre.Wim GOTO ERRORNOWINRE
    IF NOT EXIST C:\Windows\System32\Recovery\Backup MD C:\Windows\System32\Recovery\Backup
    IF NOT EXIST C:\Windows\System32\Recovery\Backup\ReAgent.xml COPY C:\Windows\System32\Recovery\ReAgent.xml C:\Windows\System32\Recovery\Backup\ReAgent.xml
    IF NOT EXIST C:\Windows\System32\Recovery\Backup\WinRE.Wim COPY C:\Windows\System32\Recovery\WinRE.Wim C:\Windows\System32\Recovery\Backup\WinRE.Wim
    
    
    ECHO ==============================================
    ECHO COPYING WINDOWSRE
    ECHO ==============================================
    MD %RECOVERYLETTER%:\Capture
    MD %RECOVERYLETTER%:\Recovery\WindowsRE
    MD %RECOVERYLETTER%:\RecoveryImage
    COPY C:\Windows\System32\Recovery\WinRE.Wim %RECOVERYLETTER%:\Recovery\WindowsRE\WinRE.Wim
    COPY C:\Windows\System32\Recovery\WinRE.Wim %RECOVERYLETTER%:\Capture\WinRE.Wim
    COPY C:\Windows\Boot\DVD\PCAT\Boot.Sdi %RECOVERYLETTER%:\Recovery\WindowsRE\Boot.Sdi
    COPY C:\Windows\Boot\DVD\PCAT\Boot.Sdi %RECOVERYLETTER%:\Capture\Boot.Sdi
    COPY ".\RecoveryFiles\*.*" %RECOVERYLETTER%:\RecoveryImage
    
    
    ECHO ==============================================
    ECHO Configuring FirstLogon.cmd
    ECHO ==============================================
    MD C:\Windows\Setup\Scripts
    ECHO SELECT DISK %DISKID% >C:\Windows\Setup\Scripts\Hdd.Txt
    ECHO SELECT PARTITION %RECOVERYPART% >>C:\Windows\Setup\Scripts\Hdd.Txt
    ECHO REMOVE >>C:\Windows\Setup\Scripts\Hdd.Txt
    IF EXIST C:\Windows\Setup\Scripts\FirstLogon.cmd (
    REN C:\Windows\Setup\Scripts\FirstLogon.cmd FirstLogon.Sav
    ECHO DISKPART /S C:\Windows\Setup\Scripts\Hdd.Txt >C:\Windows\Setup\Scripts\FirstLogon.cmd
    TYPE C:\Windows\Setup\Scripts\FirstLogon.Sav >> C:\Windows\Setup\Scripts\FirstLogon.cmd 
    DEL C:\Windows\Setup\Scripts\FirstLogon.Sav)
    IF NOT EXIST C:\Windows\Setup\Scripts\FirstLogon.cmd ECHO DISKPART /S C:\Windows\Setup\Scripts\Hdd.Txt >C:\Windows\Setup\Scripts\FirstLogon.cmd
    IF EXIST C:\Windows\Setup\Scripts\FirstLogon.cmd (
    REN C:\Windows\Setup\Scripts\FirstLogon.cmd FirstLogon.Sav
    ECHO ReAgenTC.exe /Enable >C:\Windows\Setup\Scripts\FirstLogon.cmd
    TYPE C:\Windows\Setup\Scripts\FirstLogon.Sav >> C:\Windows\Setup\Scripts\FirstLogon.cmd 
    DEL C:\Windows\Setup\Scripts\FirstLogon.Sav)
    IF NOT EXIST C:\Windows\Setup\Scripts\FirstLogon.cmd ECHO ReAgenTC.exe /Enable >C:\Windows\Setup\Scripts\FirstLogon.cmd
    IF EXIST C:\Windows\Setup\Scripts\FirstLogon.cmd (
    REN C:\Windows\Setup\Scripts\FirstLogon.cmd FirstLogon.Sav
    ECHO ReAgentc.exe /SetBootShellLink /ConfigFile C:\Windows\System32\RecoveryTools\WinRE.xml >C:\Windows\Setup\Scripts\FirstLogon.cmd
    TYPE C:\Windows\Setup\Scripts\FirstLogon.Sav >> C:\Windows\Setup\Scripts\FirstLogon.cmd 
    DEL C:\Windows\Setup\Scripts\FirstLogon.Sav)
    IF NOT EXIST C:\Windows\Setup\Scripts\FirstLogon.cmd ECHO ReAgentc.exe /SetBootShellLink /ConfigFile C:\Windows\System32\RecoveryTools\WinRE.xml >C:\Windows\Setup\Scripts\FirstLogon.cmd
    
    
    ECHO ==============================================
    ECHO MODIFYING CAPTURE IMAGE
    ECHO ==============================================
    MD %TMP%\WinRE
    DISM /Mount-Wim /Index:1 /WimFile:%RECOVERYLETTER%:\Capture\WinRE.Wim /MountDir:%TMP%\WinRE
    ATTRIB -S -R -H %TMP%\WinRE\Windows\System32\WINPESHL.INI
    DEL %TMP%\WinRE\Windows\System32\WINPESHL.INI
    XCOPY /SEVHKY .\CaptureImage\*.* %TMP%\WinRE\
    DISM /UnMount-Wim /MountDir:%TMP%\WinRE /commit
    
    
    ECHO ==============================================
    ECHO MODIFYING RECOVERY TOOLS
    ECHO ==============================================
    MD %TMP%\WinRE
    DISM /Mount-Wim /Index:1 /WimFile:%RECOVERYLETTER%:\Recovery\WindowsRE\WinRE.Wim /MountDir:%TMP%\WinRE
    XCOPY /SEVHKY .\WinRE%PROCESSOR_ARCHITECTURE%\*.* %TMP%\WinRE\
    DISM /UnMount-Wim /MountDir:%TMP%\WinRE /commit
    
    
    ECHO ==============================================
    ECHO SYSPREPING THE COMPUTER
    ECHO ==============================================
    XCOPY .\Files\*.* /SEVHKY C:\
    REAGENTC /ENABLE
    START /WAIT C:\Windows\System32\Sysprep\SysPrep.exe /generalize /oobe /quit /unattend:SysPrep.Xml
    START /WAIT CreateShortcut "C:\Windows\System32\RecoveryTools\Recovery%PROCESSOR_ARCHITECTURE%.EXE" "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Recovery Tools.lnk"
    
    
    ECHO ==============================================
    ECHO ADDING CAPTURE IMAGE
    ECHO ==============================================
    FOR /F "delims={} tokens=2" %%I IN ('BCDEDIT.EXE /create /application OSLOADER /d Capture') DO SET OSGUID=%%I
    FOR /F "delims={} tokens=2" %%I IN ('BCDEDIT.EXE /create /device /d Capture') DO SET RAMGUID=%%I
    SET OSGUID={%OSGUID%}
    SET RAMGUID={%RAMGUID%}
    bcdedit /set %OSGUID% device ramdisk=[%RECOVERYLETTER%:]\Capture\WinRe.Wim,%RAMGUID%
    bcdedit /set %OSGUID% osdevice ramdisk=[%RECOVERYLETTER%:]\Capture\WinRe.Wim,%RAMGUID%
    bcdedit /set %OSGUID% path \windows\system32\boot\%WINLOAD%
    bcdedit /set %OSGUID% locale %LANG%
    bcdedit /set %OSGUID% inherit {bootloadersettings}
    bcdedit /set %OSGUID% systemroot \windows
    bcdedit /set %OSGUID% detecthal Yes
    bcdedit /set %OSGUID% winpe Yes
    bcdedit /set %OSGUID% ems No
    bcdedit /set %RAMGUID% ramdisksdidevice partition=%RECOVERYLETTER%:
    bcdedit /set %RAMGUID% ramdisksdipath \Capture\BOOT.SDI
    bcdedit /set {bootmgr} displayorder %OSGUID% /addlast
    bcdedit /set {bootmgr} locale %LANG%
    bcdedit /set {current} locale %LANG%
    bcdedit /delete {current}
    
    
    ECHO ==============================================
    ECHO Rebooting the computer
    ECHO ==============================================
    SHUTDOWN -R -F -T 15
    GOTO QUIT
    
    :ERRORNOREC
    CLS
    ECHO *******************************************
    ECHO Recovery partition not found.
    ECHO *******************************************
    ECHO Please check settings and try again.
    ECHO *******************************************
    PAUSE
    GOTO QUIT
    
    
    :ERRORNOWINRE
    CLS
    ECHO *******************************************
    ECHO WinRE.Wim not found.
    ECHO *******************************************
    ECHO Please install this software only on 
    ECHO computer where the AutoUnattend.XMl was
    ECHO used during the installation process.
    ECHO Manually switching to AUDIT mode during
    ECHO OOBE process is not supported under
    ECHO Windows 8.
    ECHO *******************************************
    PAUSE
    GOTO QUIT
    
    
    :QUIT
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. RJOliver

    RJOliver MDL Novice

    Nov 27, 2013
    16
    0
    0

    Here you go from fresh install in audit mode.

    Windows Recovery Environment (Windows RE) and system reset configuration
    Information:


    Windows RE status: Enabled
    Windows RE location: \\?\GLOBALROOT\device\harddisk0\partition1\Recovery\WindowsRE
    Boot Configuration Data (BCD) identifier: 11369592-5e04-11e3-be37-acdcafe37d49
    Recovery image location:
    Recovery image index: 0
    Custom image location:
    Custom image index: 0


    REAGENTC.EXE: Operation Successful.
     
  15. AnarethoS

    AnarethoS MDL Expert

    Jul 31, 2009
    1,297
    1,587
    60

    Tanks! So the recouvery environment is working when you are in audit mode but seems to stop working after capture. If you have time, can you check with the updated Install script I posted just before?

    Tanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. mckinnon81

    mckinnon81 MDL Novice

    Nov 30, 2013
    5
    0
    0

    Thanks for the advice. If I tell it to create the partition as the last partition could I not then "move" the recovery partition to another hard drive?


    Could this work?

    Thanks
     
  17. mckinnon81

    mckinnon81 MDL Novice

    Nov 30, 2013
    5
    0
    0
    Have these files been updated in the beta zip or do we need to update them manually?

    Thanks
     
  18. AnarethoS

    AnarethoS MDL Expert

    Jul 31, 2009
    1,297
    1,587
    60
    Not update in the ZIP for now since I havent had the time to fully test them.

    You not to edit/replace them by hand for now.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  19. AnarethoS

    AnarethoS MDL Expert

    Jul 31, 2009
    1,297
    1,587
    60
    It will work for the partition-based recovery. USB/DVD recovery will be broken.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  20. mckinnon81

    mckinnon81 MDL Novice

    Nov 30, 2013
    5
    0
    0
    I have just tried testing with the updated install script and I still cannot boot into WinRE.

    Install Windows 8.1 from USB with the unattended.xml file
    Boots into Audit Mode with out issues. I then take and image straight away.
    Reboots to OOBE setup my user and logon to system
    Run the recovery tools and tell it I want to repair my computer and boot to WinRE. But it reboots back into windows.

    Installed using MBR Settings.
    Recovery is the first partition.