DISM - Compress install.wim ? Been using GimageX.

Discussion in 'Windows 8' started by tnx, Dec 14, 2014.

  1. tnx

    tnx MDL Expert

    Sep 2, 2008
    1,622
    233
    60
  2. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    7,716
    25,018
    240
    #2 abbodi1406, Dec 14, 2014
    Last edited by a moderator: Apr 20, 2017
    Code:
    IMAGEX /EXPORT install.wim * install2.wim /compress maximum
    or
    Code:
    dism /Export-Image /SourceImageFile:install.wim /SourceIndex:1 /DestinationImageFile:install2.wim /compress:max
    repeat dism command for each index at a time
     
  3. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,530
    655
    60
    #3 Flipp3r, Dec 14, 2014
    Last edited by a moderator: Apr 20, 2017
    As Abbodi1406 has posted but with added:
    Code:
    dism /Export-Image /SourceImageFile:install.wim /SourceIndex:1 /DestinationImageFile:install2.wim /compress:maximum
     
  4. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    7,716
    25,018
    240
    I didn't add the compress parameter since default install.wim already max compressed :D

    added
    btw, dism uses /compress:max and imagex uses /compress maximum :)
     
  5. s1ave77

    s1ave77 MDL Guide Dog/Dev

    Aug 15, 2012
    15,068
    20,297
    340
    #5 s1ave77, Dec 15, 2014
    Last edited by a moderator: Apr 20, 2017
    In CMD directly:
    Code:
    for /f "tokens=2 delims=: " %a in ('dism /english /Get-WimInfo /WimFile:"install.wim" ^| findstr /i Index') do dism /Export-Image /SourceImageFile:"install.wim" /SourceIndex:%a /DestinationImageFile:"install2.wim" /compress:max
    In Batch File:
    Code:
    for /f "tokens=2 delims=: " %%a in ('dism /english /Get-WimInfo /WimFile:"install.wim" ^| findstr /i Index') do dism /Export-Image /SourceImageFile:"install.wim" /SourceIndex:%%a /DestinationImageFile:"install2.wim" /compress:max
    Afaik it's only mandatory when converting WIM to ESD with DISM.

    You mentioned Win 10 dism can convert ESD>WIM, would be a nice feature in general.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    7,716
    25,018
    240
    It's also required if you want to change the wim compress level, say from max to fast
    and when capturing new wim


    yes it is
    the new dism version bundled with KB3000850 have that feature too
    it's installed only for boot.wim/2/sources (not install.wim)
    and can replace same dism files included in ADK
     
  7. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,530
    655
    60
    But then would you use /compress:recovery...
     
  8. tnx

    tnx MDL Expert

    Sep 2, 2008
    1,622
    233
    60
    Cheers guys.

    :biggrin:
     
  9. tnx

    tnx MDL Expert

    Sep 2, 2008
    1,622
    233
    60
    Well been messing and got a nice little script working

    But the install.wim file is exactly the same size. Does this mean the file is already compressed to the max or am I doing summet wrong ?
    I watch the Command Window doing it's thing and it says completed successfully.

    Here's a question. Why is it when I remove all the APPs the install.wim size grows ? I don't understand that bit.

    Odd my code has no gaps in the word "DISMCompressed" but when I post the code on here a gap appears ?
     
  10. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    7,716
    25,018
    240
    Exporting is not compressing, it's to eliminate redundant [Files] in the wim
     
  11. tnx

    tnx MDL Expert

    Sep 2, 2008
    1,622
    233
    60
    Ohhhh. Right. No wonder the file size did not change.

    I must be reading things wrong then. I thought that "Export-Image was for compressing the image, especially with "compress-max" on the end.

    Bit confused now.:confused:

    What should I be writing then ?
     
  12. abbodi1406

    abbodi1406 MDL KB0000001

    Feb 19, 2011
    7,716
    25,018
    240
    If the file is max compressed (which is by default) and no redundant files exist, you cann't compress it further than available
     
  13. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    6,674
    10,073
    210
    Perhaps it would be better if you stated your goals and what you're having problems with.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. tnx

    tnx MDL Expert

    Sep 2, 2008
    1,622
    233
    60
    I was just messing, removing APPs,adding REG edits. that was all ok. Then when I added some updates the install.wim was too large to fit on the USB. Formatted to FAT32 cause I want UEFI bootable.
    I did use GImageX to shrink the install.wim but just thought it would be nice to do it via DISM and write my own script.

    Have noticed talk about the latest Win 8.1 Update 3 iso's. Not downloaded any as yet.

    All I have in mind it o put a fresh install of Win 8.1 x64 in. Usually do one at crimbo time and then again summer time. Mainly cause this is the time when I have spare time to mess.

    So "murphy78", do you know this. Why is it when I remove the APPs from the install.wim the size grows. I would expect it to shrink slightly ?
     
  15. s1ave77

    s1ave77 MDL Guide Dog/Dev

    Aug 15, 2012
    15,068
    20,297
    340
    Seems they get disabled but not removed. After mounting servicing and unmount/commit the WIM will always grow in size. I export all indices afterwards for that reason.

    One could check out wimlib-imagex, it has a nice optimize option, that is usefull after servicing a WIM :good3:.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  16. murphy78

    murphy78 MDL DISM Enthusiast

    Nov 18, 2012
    6,674
    10,073
    210
    You're not going to save much space removing appx stuff. Those are already compressed and fairly small.
    If you really wanna butcher your images, you need something like winreducer. That will remove the non-english files that take up a large chunk of space.
    It can also completely remove the appx stuff rather than just disable.

    Just know that the stuff you remove, if it actually saves space, is going to make your system very glitchy.
    You won't be able to use any updates or hotfixes and any features that need to be added like hyper-x will probably not work.

    Also Nuhi updated his Nlite tool, which he says attempts to keep CBS satisfied. That's perhaps a better option, but still butchers your system.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. tnx

    tnx MDL Expert

    Sep 2, 2008
    1,622
    233
    60
    Dont want to go that far as to butcher things and make things run rough.
    Might just forget about adding the updates and just let the machine update it self.

    Will look at getting an Update 3 iso.