Problems with Factory reset after WIMBoot on a Dell Venue 11 Pro (5130) 64 Bit

Hi,

I already have a Dell Venue 8 Pro (32 bit) that I have 'converted' to WIMBoot with no problems, I also want to convert the Dell Venue 11 Pro (64 bit) I have. Everything works fine until I attempt to do a factory reset. The system appears to be doing what it should ie preparing and then it pops up a message saying basically "Cannot rest at this time", there is no error code or message to explain why it cannot be done.

I followed all of the instructions on how to convert from a standard W 8.1 boot to a W 8.1 WIMBoot, so I don't understand why the reset is not working. NB the refresh option also does not work.

My method to convert is to use a specific set of command files (I already have a WIMBoot image and a WinRE image from the device updated with the 64-bit versions of Windows 8.1: KB2919442 and KB2919355) The commands are as follows to calculate the size of the WIMBoot images partition, format and partition the hard drive and apply the image.

goto __start

/*************************************************************
          Script: CalcApplyWIMBoot.cmd

Version 1.1
* Use letter T for Windows drive - account for the USB drive being drive letter C
* Remove test for Windows drive accessibity

Use this script to calculate the size needed for the WIMBoot
Images partition

Prerequisites:
- Boot the PC into Windows PE 5.1
- The primary hard drive (disk 0) has no partitions:

After this script is run:
- The primary hard drive (disk 0) has four partitions:
     1. System partition (ESP)
     2. MSR
     3. Windows partition (calculated)
     4. Images partition (calculated)

The Images partition will include:
 - install.wim, winre.wim
 - 50 MB of additional free space

**************************************************************/

REM The script starts here
:__start
@echo off
echo %date%-%time%:: Start of script %0 ,,,

if "%1" equ "" (
 echo This script calculates the size needed for the Images partition and sets it up.
 echo Usage:
 echo CalcApplyWIMBoot.cmd ^<drive letter where Images folder resides^>
 echo Example:
 echo CalcApplyWIMBoot.cmd E:
 exit /b 0
)

if not exist %1\CalcApplyWIMBoot.cmd (
 echo %1\CalcApplyWIMBoot.cmd not found. Exiting script.
pause
 exit /b 3
)

REM --- Constants used to calculate free space ---

REM Overhead Ratio: assume 6 MB overhead per 1000 MB size
set /a NTFS_OVERHEAD_RATIO=500/497
REM Per-Partition Overhead: 5 MB per partition
set /a NTFS_OVERHEAD_BASE=5

REM Megabytes-to-Millions Ratio:
REM This ratio converts values from megabytes to millions of bytes, approximately. 
set /a mega_million_ratio=205/215

REM --------- Constants -------------

REM Drive letter of the Windows partition.
set user_volume=T:

REM Drive letter that contains \Images\install.wim. Example: E:
set wimfile_path=%1\Images

REM Drive letter that contains \Images\winre.wim. Example: E:
set winre_wim_path=%1\Images

echo Check if the install.wim file {%wimfile_path%} is accessible:
echo dir %wimfile_path%\ /a
     dir %wimfile_path%\ /a

if not exist %wimfile_path%\install.wim (
 echo %wimfile_path%\install.wim not found. Exiting script.
pause
 exit /b 3
)

echo Check if the winre.wim file {%winre_wim_path%}  is accessible:
echo dir %winre_wim_path%\ /a
     dir %winre_wim_path%\ /a
if not exist %winre_wim_path%\winre.wim  (
echo %winre_wim_path%\winre.wim not found. Exiting script.
 exit /b 3
)


echo --------- Calculate install.wim size ,,,
for %%A in (%wimfile_path%\install.wim) do ( 
set install_wim_file_bytes=%%~zA
echo install.wim is [%install_wim_file_bytes%] bytes.
)
set /a install_wim_file_MB=%install_wim_file_bytes:~0,-6%+0
echo After cutting off last 6 digits = [%install_wim_file_MB%]
set /a install_wim_file_MB=%install_wim_file_MB%*205/215
echo Final approximate size: [%install_wim_file_MB%] MB

echo --------- Calculate {%winre_wim_path%\winre.wim} size ,,,
for %%A in (%winre_wim_path%\winre.wim) do ( 
set winre_wim_file_bytes=%%~zA
echo winre.wim is [%winre_wim_file_bytes%] bytes.
)
set /a winre_wim_file_MB=%winre_wim_file_bytes:~0,-6%
echo After cutting off last 6 digits = [%winre_wim_file_MB%]
set /a winre_wim_file_MB=%winre_wim_file_MB%*205/215
echo Final approximate size: [%winre_wim_file_MB%] MB


echo Calculate Images partition size ,,,
echo Adding 50MB free space. This ensures Images partition have 50MB free space.
set /a more_size=50
set /a wim_partition_size_MB=%install_wim_file_MB%
echo Size sum of install.wim = {%wim_partition_size_MB%} MB
set /a wim_partition_size_MB=%wim_partition_size_MB%+%winre_wim_file_MB%
echo Total size of the 2 .WIM files = {%wim_partition_size_MB%} MB

set /a wim_partition_size_MB=%wim_partition_size_MB%+%more_size%
echo Size after adding specified space and 50MB = {%wim_partition_size_MB%} MB
set /a wim_partition_size_MB=%wim_partition_size_MB%+%NTFS_OVERHEAD_BASE%
set /a wim_partition_size_MB=%wim_partition_size_MB%*500/497
echo Final Images partition size = {%wim_partition_size_MB%} MB

echo Find out if we are in BIOS mode, or UEFI mode,,,
echo reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType
     reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType
for /f "tokens=2*" %%X in ('reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType') DO (SET _Firmware=%%Y)

if %_Firmware%==0x1 (
  echo The PC is booted in BIOS mode. Note: BIOS is not supported for WIMBoot.  Exiting script.
pause
 exit /b 3
)

if %_Firmware%==0x2 echo The PC is booted in UEFI mode.

echo Create a diskpart script to shrink Windows partition {%user_volume%} by desired size of {%wim_partition_size_MB%} ,,
set wim_partition_letter=M:

echo. > %~dp0dps.txt
echo list disk >> %~dp0dps.txt
echo list volume >> %~dp0dps.txt
echo select disk 0 >> %~dp0dps.txt
echo clean >> %~dp0dps.txt
echo convert gpt >> %~dp0dps.txt
rem == 1. System partition (ESP)
echo create partition efi size=500 >> %~dp0dps.txt
echo format quick fs=ntfs label="System"  >> %~dp0dps.txt
rem == 2. Microsoft Reserved (MSR) partition
echo create partition msr size=128 >> %~dp0dps.txt
rem == 3. Windows partition
echo create partition primary >> %~dp0dps.txt
echo shrink minimum=%wim_partition_size_MB% >> %~dp0dps.txt
echo format quick fs=ntfs label="Windows" >> %~dp0dps.txt
echo assign letter=%user_volume% >> %~dp0dps.txt
rem === 4. Images partition
echo create partition primary >> %~dp0dps.txt
echo format quick fs=ntfs label="Images" >> %~dp0dps.txt
echo assign letter=%wim_partition_letter% >> %~dp0dps.txt
echo set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac" >> %~dp0dps.txt
echo gpt attributes=0x8000000000000001 >> %~dp0dps.txt
echo list volume >> %~dp0dps.txt
echo list partition >> %~dp0dps.txt
echo exit >> %~dp0dps.txt

echo =================== the script has:
type  %~dp0dps.txt
echo ==================================

echo %date%-%time%:: Running diskpart /s %~dp0dps.txt ,,,
diskpart /s %~dp0dps.txt 

echo dir %wim_partition_letter%\
dir %wim_partition_letter%\

md "%wim_partition_letter%\Windows Images"
md "%wim_partition_letter%\Recovery\WindowsRE"

echo robocopy %wimfile_path%\ "%wim_partition_letter%\Windows Images"\ install.wim
     robocopy %wimfile_path%\ "%wim_partition_letter%\Windows Images"\ install.wim
echo dir %wim_partition_letter%\
dir %wim_partition_letter%\
echo dir "%wim_partition_letter%\Windows Images"
dir "%wim_partition_letter%\Windows Images"

echo dir %winre_wim_path%\winre.wim
     dir %winre_wim_path%\winre.wim
echo robocopy %winre_wim_path%\ %wim_partition_letter%\Recovery\WindowsRE\ winre.wim
     robocopy %winre_wim_path%\ %wim_partition_letter%\Recovery\WindowsRE\ winre.wim

rem == Create a scratch directory for DISM operations 
md %user_volume%\Recycler\Scratch
 
rem == Apply the Windows image to the Windows partition == 
echo %date%-%time%:: Dism /Apply-Image /ImageFile:"%wim_partition_letter%\Windows Images\install.wim" /ApplyDir:%user_volume% /Index:1 /WIMBoot /ScratchDir:%user_volume%\Recycler\Scratch 
     Dism /Apply-Image /ImageFile:"%wim_partition_letter%\Windows Images\install.wim" /ApplyDir:%user_volume% /Index:1 /WIMBoot /ScratchDir:%user_volume%\Recycler\Scratch 

rmdir %user_volume%\Recycler\Scratch

rem == Create boot files on the System partition == 
%user_volume%\Windows\System32\bcdboot %user_volume%\Windows
  
rem == Register Windows RE
echo %date%-%time%:: %user_volume%\Windows\System32\reagentc.exe /setreimage /path %wim_partition_letter%\Recovery\WindowsRE /target %user_volume%\Windows
      %user_volume%\Windows\System32\reagentc.exe /setreimage /path %wim_partition_letter%\Recovery\WindowsRE /target %user_volume%\Windows

echo %date%-%time%:: Running Dism /english /logpath=%wimfile_path%\dism.log /get-wimbootentry /path=%user_volume%\  piping into %~dp0temp.txt ,,,
      dism /english /logpath=%wimfile_path%\dism.log /get-wimbootentry /path=%user_volume%\ 1> %~dp0temp.txt 2>&1
type %~dp0temp.txt

set output_text=%~dp0temp.txt

find /i "install.wim" %output_text%
if %errorlevel% neq 0 (
 echo The file: install.wim not found. Script failed, exiting.
pause
 exit /b %errorlevel%
)

echo Found install.wim, good.

for /f "skip=4 tokens=1,2,3,4,5" %%a in (%output_text%) do (
 if /i "%%a %%b %%c %%d" equ "Data Source ID :" ( set ds_id_install_wim=%%e )
 if /i "%%~nxd" equ "install.wim" ( set wimfile_install_wim=%%~nxd & goto _end_for1 )
)
:_end_for1

echo dsid=%ds_id_install_wim%
echo wim=%wimfile_install_wim%

echo %date%-%time%:: Running Dism /logpath=%wimfile_path%\dism.log /update-wimbootentry /path=%user_volume%\ /imagefile="%wim_partition_letter%\Windows Images\install.wim" /datasourceID=%ds_id_install_wim% ,,,
dism /logpath=%wimfile_path%\dism.log /update-wimbootentry /path=%user_volume%\ /imagefile="%wim_partition_letter%\Windows Images\install.wim" /datasourceID=%ds_id_install_wim%

@echo off
if %errorlevel% neq 0 (
 echo ERROR: Dism failed. Exiting script.
pause
 exit /b %errorlevel%
)

echo Setting permissions (ACLS) on "%wim_partition_letter%\Windows Images" ,,, 
icacls "%wim_partition_letter%\Windows Images" /grant:r SYSTEM:(F) /T 
icacls "%wim_partition_letter%\Windows Images" /inheritance:r /T 
icacls "%wim_partition_letter%\Windows Images" /grant:r *S-1-5-32-544:(R) /T
icacls "%wim_partition_letter%\Windows Images" /grant:r SYSTEM:(R) /T 

echo %date%-%time%:: All done.  Errorlevel={%errorlevel%}
dir %wim_partition_letter%\ /s /a

Any help as to why the factory reset and refresh are not working would be appreciated.

June 24th, 2015 4:13am

Hi,

Regarding to scripting questions, our help might be limited and Id suggest we post at TechNet scripting forum. There you can get more effective suggestion by other experts who familiar with design of script modification. Your understanding is highly appreciated.

TechNet script center

https://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?forum=ITCG

Regards,

D. Wu

Free Windows Admin Tool Kit Click here and download it now
June 28th, 2015 9:53pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics