Windows 10: Reducing the disk footprint


An Overview

A while back, a blog post at talked about the things that Windows 10 does differently in order to reduce the total disk footprint. 


Part of these savings come from the fact that Windows 10 systems no longer need or use recovery images, so you can get back 4GB from that.  Instead of using a recovery image, the reset process used by Windows 10 reconstructs the operating system using the components in the \Windows\winsxs folder structure.  (This also has the added benefit that the OS is almost fully patched after the reset.  All but the most recent 30 days of components updates are automatically used.  That’s by choice: you might be resetting to deal with a problem with components that were upgraded in the last month, which would be counter-productive.)

The remaining disk space benefit comes from an optional compression mechanism called Compact OS.  This works by taking many of the OS files and putting them into a single hidden container (basically a WIM file), where they are compressed and all the disk sector waste is eliminated. 

See for more information about Compact OS.

This is an evolution from the WIMBoot capabilities provided in Windows 8.1.  It’s easier to set up and deploy, and can even be done after the OS has been installed. 

WIMBoot with Windows 8.1:  Revisited

WIMBoot can still be used with Windows 8.1.  If you want to do that, it is easier than it used to be because all the needed pieces are included in the Windows PE images provided in the ADK for Windows 10.  So the steps to do this using MDT are easier:

  • Copy the LTIApplyWIMBoot.wsf script from my WIMBoot blog post into your MDT deployment share.
  • Modify your task sequence to add a condition to the existing “Install Operating System” to cause it to be skipped (don’t disable it, as that affects the wizard), e.g. task sequence variable “NOTEXIST” equals “NOVALUE”.
  • Add a new “Run command line” script after the “Install Operating System” step and configure it to run:

    CSCRIPT.EXE %ScriptRoot%\LTIApplyWIMBoot.wsf

Then you’re ready to deploy.

Compact OS with Windows 10

With Windows 10, the compact OS setup does not require any special images or additional partitions.  It doesn’t use a WIM file, and the compressed files are stored on the normal OS volume.  So there are no special steps needed to configure a machine for compact OS.  You just need to specify that this should be enabled.  There are different ways to do this, depending on how you are deploying (or have deployed) Windows 10.  These are covered in the following sections.

Compact OS manually

If you want to try the new compact OS capability, you can do this directly from Windows PE.  Here are the steps:

  1. Format and partition the disk as required.
  2. Apply the OS image to an NTFS partition using DISM:

    DISM.EXE /Apply-Image /ImageFile:INSTALL.WIM /Index:1 /ApplyDir:C:\ /Compact:ON

  3. Run BCDBOOT C:\WINDOWS to set up the OS to boot.
  4. Reboot.

Compact OS with MDT 2013 Update 1

With MDT 2013 Update 1, MDT moved from using ImageX.exe to apply images to instead use DISM.EXE.  That’s convenient, because it makes it easy to tweak MDT to add the /Compact:ON switch.  To do this, open up LTIApply.wsf in Notepad and find these lines and add the three highlighted ones:

' Apply the image

sCmd = " /Apply-Image /ImageFile:""" & sImagePath & """"
If sRWMPath <> "" then
    sCmd = sCmd & " /SWMFile:""" & sRWMPath & """"
End if
If sSWMPath <> "" then
    sCmd = sCmd & " /SWMFile:""" & sSWMPath & """"
End if
sCmd = sCmd & " /Index:" & sImageIndex & " /ApplyDir:" & sDestinationDrive
If UCase(oEnvironment.Item("OSDCompact")) = “TRUE” then
    sCmd = sCmd & " /Compact:ON"
End if

With those new lines in place, any time the “OSDCompact” variable is set to TRUE, it will add the DISM command line option to set up the compact OS while the image is being applied.  (You might want to set this variable conditionally, e.g. only on systems with 32GB or smaller hard drives.)

Compact OS with ConfigMgr

In theory, you can do something similar with ConfigMgr, replacing the built-in “Apply Operating System” step with a script that does the same thing.  But that’s quite a bit of work, for a couple of reasons:

  • The script needs to set the same variables that the built-in step does, otherwise the task sequence will fail.
  • The script can’t be used from a “Run command line” step because you can’t use an OS image package with such a step.  To work around this, you need to create a new custom step and add that to the task sequence editor via a MOF file.  (You can cheat and reuse the “Apply Operating System” step’s UI, since the script needs the same inputs anyway.  That just ends up looking rather weird.)

Fortunately, there is an easier way.  You can allow the OS to be deployed without initially configuring it for compact OS, then convert it afterwards, as part of the task sequence.  This will temporarily take up more disk space (about 3GB on a 64-bit system), but I’ll take that for the simplicity of it.

To make this work, set up a new “Run command line” step somewhere in the “State Restore” phase of an MDT-generated ConfigMgr task sequence for Windows 10.  For this step, specify the following command line:

COMPACT.EXE /CompactOS:always

This uses one of the new compact OS switches that have been added to COMPACT.EXE in Windows 10.  This will take 15-20 minutes to compact the OS files, but that’s all there is to it.

Compact OS manually, take 2

You can probably guess from the ConfigMgr section above that the exact same COMPACT.EXE command line can be used on any Windows 10 system to enable (compress) or disable (decompress) compact OS.  Feel free to try it on your system:

COMPACT.EXE /CompactOS:always

knowing you can turn it back off again with:

COMPACT.EXE /CompactOS:never

Comments (23)
  1. Scott L Smith says:

    I just tried it! Saved me 1GB of space in less than 6 minutes. Works for me.

  2. Jay Connor says:

    Is there a sample scriptcustom step for configMgr that lets you change the Apply Operating System options. It would help us with something else we need to achieve.

  3. Well, there was – I wrote one last year for WIMBoot. But I lost it somewhere along the way and didn’t have time to recreate it. It is a little tricky. What sort of options are you looking to change?

  4. Jay Connor says:

    Ah damn!

    I’d like to use imagex or dism to apply the image as OsdApplyOs.exe has some permission errors when applying to vhd mounted drives which the team doesn’t seem to want to change for now. Would be a good work around to what I have posted at UserVoice:

  5. ZIPmagic says:

    compactos provides only very marginal space savings. Take a look at the infographic here:

    If you are looking to compress your disk, this tool literally halves Windows 10’s footprint – guaranteed!

  6. *** says:

    "Microsoft-Windows-SetupImageInstallOSImageCompact" does not effect.

  7. Jason says:

    So how would this all come into play with creating a reference image to capture into a wim? If I have MDT applying the bits like the drivers, os files, software etc, where would I do this?

    Or do I take a pc, do the dism commands listed above, capture that wim, and replace the W10 OS bits I have in MDT with that?


  8. This isn’t something done at the time of image creation – it’s done when the image is deployed, per machine. (The image capture process is file-based, so it won’t even notice that the system has been "compacted.")

  9. Jimmy Dee says:

    Honestly, what kind of user is seriously worried about 1GB in disk space? Or even 4GB?

    Especially when there are things like System Protections that can take up as much as 50% of the disk?

    I haven’t built a computer with smaller than 115gb C: partition for 15 years. And I haven’t built one that needed much more than that either. My current win10 laptop has a dual SSD in RAID0, so I have a bit more room for games and such, but for work, the computers
    in our network all range from 25 (fresh and clean) to 45~50gb of footprint on C. Anything up to that is perfectly fine. Anything less than that is just too fresh to count and anything more than that needs a bit of cleanup.

    Rather than waste time with stuff like saving a couple of gigs, why not just set up some basic best practices for common hardware deployments.

    We want a second taskbar to make the most of single monitor setups.

    OH and Aero Glass yeah?

  10. You care if you have a 16GB or 32GB system. Otherwise, no, you don’t.

    As for the other complaints, please use the Windows Feedback tool to submit your feedback. It’s safe to say Gabe doesn’t read my blog.

  11. kubik256 says:

    Cleaning temporary directories & updates backups will probably free much more space and don’t have that bad side effect of using more CPU for decompress 😉

  12. computer user says:

    "You care if you have a 16GB or 32GB system."

    What person in their right mind would have that small of a hard drive these days? I can perhaps understand tablets having that little space, but all laptops and desktops should have at least 120 gigs or more of space.

  13. lungphetch says:


  14. Robin says:

    "What person in their right mind would have that small of a hard drive these days? I can perhaps understand tablets having that little space, but all laptops and desktops should have at least 120 gigs or more of space."

    Industrial devices.

  15. codevark says:

    "all laptops and desktops should have at least 120 gigs or more of space" uh, yeah, unless you’re an underfunded academic research lab running 32gb VMs. Welcome to the world of the real, Neo.

  16. SpaceGuy says:

    Thanks for sharing this excellent technical information. With regards to "Instead of using a recovery image, the reset process used by Windows 10 reconstructs the operating system using the components in the Windowswinsxs folder structure." How can one
    take this statement in consideration when creating a System Image Backup to USB?

  17. Jason says:

    How do you set a condition that will enable compact on for hard drives 32GB and smaller? I have some computers, destined for use as digital signs, and they have 32GB SSDs (28GB usable), and the stock image of Win10 Enterprise with Powerpoint 2016 is around

  18. joel borges says:

    thank you for this product

  19. Another Jason says:

    I have to agree with codevark Robin, why SHOULD you have that much space when memory sticks are so cheap and now are larger than 1TB!

  20. pete says:

    What about those running Personal Virtual Desktops.. Any saving is huge when deploying say 40 desktops in a VDI enviroment.

  21. Drew says:

    I would think VDI would only be one set of the files booted from a gold image. It would save memory but not really disk space at the cost of CPU. I don’t think there is a hard line as to right or wrong in this instance, but it should be a consideration
    and should be tested.

    In regard to drive space, there are plenty of Surface tablets running around with 32-64gb drives. Good luck replacing the hdd in those with something bigger. Good trick!

  22. ntwrkguru says:

    "What person in their right mind would have that small of a hard drive these days? I can perhaps understand tablets having that little space, but all laptops and desktops should have at least 120 gigs or more of space."

    LOTS of student laptops are 16and 32GB SSD. When the overwhelming majority of work product is kept in the cloud, that seems sufficient…until updates and patches continue to nibble away those precious gigabytes.

  23. A_Rayo says:

    First of all – thank you for this tool. And thank you for the new ways in which Windows 10 needs less and less of disk space. Very much welcome 🙂 No wonder a lot of people say it’s the best Windows ever!

    However I would like to raise little concern about SSD and wear – does compression, the process of compressing and uncompressing data cause wear to an SSD? Wear that without compression, uncompression, the data would be directly accessible, therefor reducing the amount of reads and writes?

Comments are closed.

Skip to main content