Win 8.1.1 High Compression

Discussion in 'Other Tools' started by Glenn, Jan 4, 2015.

  1. Glenn

    Glenn Administrator Staff Member

    I was chatting with WindowsGuru about sysprep and he mentioned about his using a install.esd instead of install.wim

    Here's my results:

    22 minutes later and my Win 8.1.1 x64 Pro Dec 15 install.esd is 2.49GB

    Man that is 3.28GB down to 2.49GB or 790MB saved

    I used this script I made instead of the below app
    Code:
    D:\AwakenOS\Tools\WAIK_x64\dism /export-image /sourceimagefile:D:\AwakenOS\99Output\AwakenOS811\sources\install.wim /sourceindex:1 /destinationimagefile:D:\AwakenOS\99Output\AwakenOS811\sources\install.esd /compress:recovery
    http://www.mediafire.com/download/m41adac864nivqw/ESD2WIM-WIM2ESD-dism.7z

    I am running some time tests now to see if it's much difference to installing from a wim, but if it's not to much more then that is a big space saving without removing anything.

    -EDIT-

    The main piece being "/compress:recovery", it only works with Windows 8+ DISM, but if your installing win 7 from a win 8 pe, I guess it'll work fine for 7 too.

    -EDIT-

    Extract(Install) Times MM:SS
    WIM: 3:05
    ESD: 4:07

    There seems to be 1/4 longer than total time of a wim extra, but that is well worth the 790mb saved because of it.
     
    Last edited: Jan 4, 2015
    bphlpt likes this.
  2. bphlpt

    bphlpt A lowly staff member Staff Member

    Is there a corresponding script available to decompress the esd back to a wim if you want to make changes to it, or do you have to go back to your original source? This would also be handy for releases available from MS that are released as esd. I assume such a decompression method is available, but since I haven't tried to mess with Win 8 yet I just haven't been exposed to it.
     
  3. Glenn

    Glenn Administrator Staff Member

    I am not sure myself yet, I don't think you can mount them like you can with a WIM so depends what your trying to do to what format you should use, I think esd for a public release, wim for private (where size isn't as important or at least as important as speed is) and VHD for the main source (used as the base for updated Windows).

    I am planning on doing up a tutorial on the whole lot of this (providing scripts) as the scripts got a lot more interest back in the day and the Builders were too complex for people to adopt or mod, Not planning on comming back to full work, just want a project that I can do as my poor PC has only been used as a seed box recently and a HTPC during the day. I need to put something challenging and useful back into my routine before I lose all my old skill set.
     
    bphlpt likes this.
  4. Glenn

    Glenn Administrator Staff Member

    Here is the beginnings of my automated sysprep/esd project, I have only managed to get the VirtualBox and vhd to be created so far, but it tests if a HDD already exists and if not it will format it with one active partition so that it can mount imagex (dism) from the VHD without to many manual jobs.

    * MUST RUN SCRIPT AS ADMINISTRATOR *
    01_Execute_VirtualBox.cmd:
    Code:
    @echo off
    rem User Set Variables:
    set ProjectName=AwakenOS10
    set VMName=AwakenOS10VM
    set MountISO=Win10_x64.iso
    set VHDSize=34000
    set VirtMem=1536
    set VHDFile=HDD2.vhd
    set VirtDrive=V
    
    rem System Set Variables:
    rem This first for routine will give the current path without a trailing \
    %~d0
    cd "%~dp0"
    cd %~dps0
    
    for %%f in ("%CD%") do set CP=%%~sf
    for %%f in ("C:\Program Files\Oracle\VirtualBox") do set VBP=%%~sf
    set VBM=%VBP%\VBoxManage.exe
    set VMP=%CP%\01VirtualMachine
    set ToolsPath=%CP%\Tools
    
    echo *** Project %ProjectName% ***
    echo All Folders Are Short Folder Names:
    echo.
    echo     Current (CP): %CP%
    echo VirtualBox (VBP): %VBP%
    echo    Virtual Drive: %VirtDrive%
    echo.
    rem pause
    
    echo *** Check/Configure VirtualBox ***
    %VBM% createvm --name "%VMName%" --register --basefolder "%VMP%"
    %VBM% modifyvm "%VMName%" --memory %VirtMem% --acpi on --boot1 dvd
    %VBM% modifyvm "%VMName%" --nic1 nat --nictype1 82540EM --cableconnected1 on
    %VBM% modifyvm "%VMName%" --ostype Windows81_64
            
    %VBM% modifyvm "%VMName%" --vram 32 --accelerate3d on
    %VBM% modifyvm "%VMName%" --audio dsound --audiocontroller hda
    %VBM% modifyvm "%VMName%" --clipboard bidirectional --draganddrop bidirectional
    %VBM% modifyvm "%VMName%" --mouse usbtablet --ioapic on
          
    echo *** Make HDD ***
    If EXIST %VMP%\%VHDFile% set Format=FALSE
    rem I use this instead of diskpart now it's faster:
    %VBM% createhd --filename "%VMP%\%VHDFile%" --size %VHDSize% --format VHD
    
    echo *** Make Attach and Detach Scripts ***
    echo select vdisk file="%VMP%\%VHDFile%">attach-script.txt
    echo attach vdisk>>attach-script.txt
    echo SELECT PART 1 >>attach-script.txt
    echo assign letter=%VirtDrive%>>attach-script.txt
    
    echo select vdisk file="%VMP%\%VHDFile%">detach-script.txt
    echo detach vdisk>>detach-script.txt
    
    If [%Format%]==[] (
    rem echo Format (created File Above)
    rem echo create vdisk file="%VMP%\%VHDFile%" maximum=%VHDSize% type=fixed>create-script.txt
    echo select vdisk file="%VMP%\%VHDFile%">create-script.txt
    echo attach vdisk>>create-script.txt
    echo create partition primary>>create-script.txt
    echo active>>create-script.txt
    echo assign letter=%VirtDrive%>>create-script.txt
    echo format quick fs=ntfs label=%ProjectName%>>create-script.txt
    echo detach vdisk>>create-script.txt
    
    diskpart /s create-script.txt
    )
    
    echo  *** Attach HDD ***
    %VBM% storagectl "%VMName%" --name "SATA Controller" --add sata --controller IntelAHCI
          
    echo *** Set to 2 SATA ports (defaults to 30, which crashes VM) ***
    %VBM% storagectl "%VMName%" --name "SATA Controller" --portcount 2
          
    %VBM% storageattach "%VMName%" --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "%VMP%\%VHDFile%"
          
    echo *** Attach DVD Image in SATA mode ***   
    %VBM% storageattach "%VMName%" --storagectl "SATA Controller" --port 1 --device 0 --type dvddrive --medium "%CP%\00ISO_Sources\%MountISO%"
          
    echo *** Set Custom Boot Logo ***
    %VBM% modifyvm "%VMName%" --bioslogoimagepath "%ToolsPath%\ssOSModderLogo.bmp"
    
    echo *** Run VirtualBox Here ***   
    %VBM% startvm "%VMName%
    echo.
    pause
    Requirements:
    VirtualBox

    Next I'll be working on the cleanup script that is inside a .iso so it can mount to the VM then I'll move on to the dism from host stuff, I already have both these written up from my last attempts but they never used the new esd format nor a ISO to get the cleanup script in to the VM without having to install VM tools etc.
     
  5. bphlpt

    bphlpt A lowly staff member Staff Member

    If nothing else I notice that this tool - http://forums.mydigitallife.info/threads/50572-MSMG-ToolKit-for-Windows-7-8-1-Server-2008-2012-R2 - seems to be able to convert from esd to wim, among many other capabilities.
     
  6. Glenn

    Glenn Administrator Staff Member

    I found a bug/fix that I wasn't aware of until now strange how you can output to a file but it fails if you end with a number (you can put a space, but diskpart hates that extra space).:

    Code:
    echo 1>file.txt
    outputs an empty file.txt
    
    It works when using:
    (echo 1)>file.txt
    The parenthesis limit the instruction, and then it works.
    also I just discovered esd can not be captured from a mounted image, it can only be exported from an existing wim file, so it's two steps after all.
     
  7. Glenn

    Glenn Administrator Staff Member

  8. Glenn

    Glenn Administrator Staff Member

    Well I got a very sloppy and basic collection made up, busy tomorrow for the first half of the day, if I produce anything exciting tomorrow night I'll share my progress, but for now, esd's are perfect for any public mods people are sharing, so a worth while find.
     
  9. Trouba

    Trouba Administrator Staff Member

    Oh man, I didn't know you didn't know about this. I thought I told you a while back. I would have assumed you knew this anyway since murphy would release his images in esd format sometimes.

    But you're right, it's a good thing for uploading due to saved time/bandwidth; otherwise, not so much.

    ESD is an encrypted image format and as such no third party tool can handle it besides Microsoft's own development tools. Also, ESD's cannot be mounted; you would have to convert to .wim first for that.

    Imagine what space you could save if you would seal all updates with NTLite, and then make the image into esd. It would probably shave off close to 2gb...
     
  10. bphlpt

    bphlpt A lowly staff member Staff Member

    What you are running into is special redirection syntax that usually applies most specifically to 1 and 2, see here - http://ss64.com/nt/syntax-redirection.html:
    Code:
    Numeric handles:
    
    STDIN = 0 Keyboard input
    STDOUT = 1 Text output
    STDERR = 2 Error text output
    UNDEFINED = 3-9
    
    Which you can use, among other ways, like this:
    Code:
    Redirect to NUL (hide errors)
    
    command 2> nul Redirect error messages to NUL
    command >nul 2>&1 Redirect error and output to NUL
    
    In your case, the statement - "echo 1>file.txt" - was interpreted as 'Take the output of the statement - "echo" - and redirect that output, ie "1", to the file "file.txt" .'

    Bracketing the command or commands with ( ... ), as you discovered, is actually the preferred way around this "problem".
     
    Last edited: Jan 5, 2015
    Glenn likes this.
  11. Glenn

    Glenn Administrator Staff Member

    I have attached a slightly cleaned up version of the beginnings of my work today, let me know if you get time to look at it over the next few days (it should be safe to use on your main PC's):

    Here is the How_To_Use.txt I included, it lets you follow what is does.

    Code:
    Preperation:-
    Put a iso in the 00ISO_Sources folder, I used: Win10_x64.iso (Edit MountISO.txt in Settings to reflect ISO used)
    Edit the \Settings files, especially the MountISO.txt, Arch.txt, WinVersion.txt and ProjectName.txt
    
    01_Execute_VirtualBox.cmd:-
    First you must be able to run this script as an Administrator or diskpart may fail to configure the VHD.
    
    Run 01_Execute_VirtualBox.cmd As Administrator
    
    Press a Key as your VM boots
    Install your version of windows to the pre-formated partition (do NOT make new partitions).
    When the windows installation gets to the first OOBE screen (asking for you to make a new user/log in/pick settings or add WIFI) press CTRL + Shift + F3. Pressing those keys will put the OS in Audit (Administrator) mode and allow you to update/edit things without needing to make then remove a temp user this will reduce the junk that windows and users make to the Drive/VHD you plan to image/capture once sysprep is applied later on.
    
    Run A Microsoft Update (skip Removal Tool and Defender update etc that get outdated quickly), then install any Runtimes/Dot.NET/Features and any hard tweaks/themes/mods you may want to include.
    
    02_Clean-VM_VirtualBox.cmd:-
    
    Leave the VM in VirtualBox running 
    Run 02_Clean-VM_VirtualBox.cmd (You can also run this at any time to re-clean the VM prior to imaging again (Skipping Run 01_Execute_VirtualBox.cmd))
    This will mount the Clean-VM.iso so that you can run the 1.VM-Clean.cmd off the VirtualBox's DVD Drive to clean the OS prior to the capture.
    
    Before you can capture the image you must set the System Preparation Tool to "Enter System Out-of-Box Experience (OOBE)", Check Generalize (Ticked) and change the Shutdown Options to "Shutdown" press OK to shut down the VM (Read Appended info for how to make more changes.
    
    
    03_Capture_Image.cmd:-
    
    Wait until the VM has fully ShutDown
    Run 03_Capture_Image.cmd as Administrator
    This will mount the VHD to a local Virtual Disk and use DISM to capture an install.wim
    Once the install.wim completes it will convert it to install.esd
    
    
    04_Create_ISO-Folders.cmd:-
    
    Wait until the install.esd has been created
    Run 04_Create_ISO-Folders.cmd and it will produce an ISO Structure in a 09Output subfolder.
    
    
    05_Build_ISO_File.cmd:-
    
    This builds an ISO to the 09Output folder (you can skip the ISO creation and manually copy the install.esd straight to an existing bootable USB or ISO file using other tools).
    
    
    Extra Info:-
    
    * If you want to re-update/edit an existing HDD.vhd image you can run the VM and use the Ctrl + Shift + F3 to enter Audit Mode.
    
    * To Reboot The VM You can change the Sys Prep Tool to "Audit", UnCheck Generalize and "Reboot" then press OK
    
    * If you want to do another OS/Version then back up the \01VirtualMachine\HDD.vhd manually if you want to keep it or optionally you can use VirtualBox to export/clone or remove the VM and/or the HDD image.
     

    Attached Files:

  12. kirk44

    kirk44 Guest

    nice work, the original script I gave you has option to do both esd to wim and wim to esd.
     

Share This Page