• Doing a clean install of Win10 21H2. How to generate a install.wim file?

    Home » Forums » AskWoody support » Windows » Windows 10 » Windows 10 versions – no longer supported » Windows 10 version 21H2 – November 2021 Update » Doing a clean install of Win10 21H2. How to generate a install.wim file?

    Author
    Topic
    #2419651

    I have a question, which I think should be simple but has me stumped.  I am setting up a new computer (bare metal out of the box).  I have installed Win 10 (21H2) on it.  I ran sfc /scannow and was surprised that it had a do a few repairs in this clean install.   (Looked at the CBS.log file.)

    Now the sfc /scannow returns no errors.  😉

    It seems to me that it would be a nice time to generate my own install.wim file and save somewhere on the network in case a file gets corrupted, I would have a nice image for the immediate future.  I can’t for the life of me seem to do this simply.

    Is there a dism command I can execute to accomplish this?

    Viewing 9 reply threads
    Author
    Replies
    • #2419684

      To create a proper image file (??.wim), you need to do it while Win10 is off-line (otherwise the image won’t include some of the “in-use” files.)

      To create an image file:

      Boot from a Win10 install USB

      Press Shift + F10 at the first screen to get a cmd prompt

        Diskpart

        List Vol (to determine the correct Win10 drive letter; it’s not always C:)

        Exit

      DISM /Capture-Image /ImageFile:<path to save image to> /CaptureDir:<Win10 source drive (from list vol)> /ScratchDir:<path for temp files> /Name:<name for the image> /description:<desciption for the image> /CheckIntegrity /Verify /EA

      Exit cmd once DISM indicates the image is complete.

      Exit windows install and reboot.

      Note, don’t set the ImageFile and Scratchdir paths to the same drive as the Win10 source. While DISM will accept them, it’ll significantly slow down the whole capture process because it’ll be trying to capture those files at the same time it’s creating them.

      Also, the location were you want to save the image must have enough free space to hold it.


      To apply a saved image:

      Boot from a Win10 install USB

      Press Shift + F10 at the first screen to get a cmd prompt

        Diskpart

        List Vol (to determine the correct Win10 vol, it’s not always Vol Ø)

        Select Vol # (the one you want to restore Win10 to)

        Format fs=NTFS quick label=<your Win10 drive label> (quick label is optional)

        Exit

      DISM /Apply-Image /ImageFile:<path to saved image> /index:1 /applydir:<Win10 source drive (from list vol)>

      Exit cmd once DISM indicates the image has been restored.

      Exit windows install and reboot

      Note, if you don’t format the drive before applying the image, you’ll get “unable to access” errors for all the Win10 system directories and the restore will mess up your Win10 drive. The fix is to redo the whole restore process and make sure you format the drive before restoring the image (BTDT.)

      1 user thanked author for this post.
    • #2419706

      With Windows booted, create a new folder on the root of a partition, name the folder whatever you like.

      Insert your Windows 10 installation USB into a USB slot, and open it in File Explorer. Go to \sources and look for install.esd. Copy install.esd to your new folder.

      Open an elevated Command Prompt and navigate to your new folder (to where you copied install.esd). That simplifies path statements. Now type

      dism /get-wiminfo /wimfile:install.esd

      and hit Enter. Your install.esd can contain six or seven Windows 10 versions. Look at the list for the number that corresponds to the version of Windows 10 you are running. Then type (replace X with your version number)

      dism /export-image /sourceimagefile:install.esd /sourceindex:X /destinationimagefile:install.wim /compress:max /checkintegrity

      When the export is complete, you can exit the Command Prompt.  You now have install.esd and install.wim in your new folder. If you wish, you can copy your Windows 10 installation USB to another USB thumb drive, delete the install.esd file in that drive and replace it with install.wim.

      If you do that, you no longer need the new folder you created nor the install.esd and install.wim.

      Always create a fresh drive image before making system changes/Windows updates; you may need to start over!
      We all have our own reasons for doing the things that we do with our systems; we don't need anyone's approval, and we don't all have to do the same things.
      We were all once "Average Users".

      1 user thanked author for this post.
    • #2419776

      OK, just some comments (all preceding posts being correct, or course.)- Install.wim is install.ESD on the entitlement downloads (same file, extracts with DISM)

      As to generating that file, why bother?

      If you want to back up a “bare metal” Microsoft method re-install image for your PC, get the base software installed and updated and sysprep the resulting image, so you can attain a FFU image and restore the machine to that condition from bare metal without even knowing about the partitioning (though if you change the drive, you need a larger one, and you will have to make a user account at the end of Sysprep, so you might have to do some adjusting there.)

      The thing to be aware of is the Windows license can interact with licenses of both Microsoft (eg Office 365) and non Microsoft (eg AVG antivirus) products so best not rely on licensed software being graceful in this restoration method.

      https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/deploy-windows-using-full-flash-update–ffu?view=windows-11

      Windows licensing should sort itself out. If sysprep fails (which stops the image capturing most times), check the log. In that instance you might need to remove something not in add/remove programs, see https://www.askwoody.com/forums/topic/driver-updates-get-auto-installed-regardless-of-wushowhide-or-wumgr/#post-2419319 )

      Finally if the “Windows drive” isn’t drive C, something is awry with respect to “POST side” UEFI support, or you aren’t using the recommended UEFI partition layout (not that that has stopped a certain large OEM from jamming a 1Gb partition between the MSR and Windows partitions on some of their laptops..)

      https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/configure-uefigpt-based-hard-drive-partitions?view=windows-11

      Of course if you have a spare USB hard disk (NOT USB key.. wrong drive class) now “too small” for a sensible backup, you have another use for it. Partition it as a UEFI drive but make the boot partition 30Gb, image your recovery drive to a wim file as given, and extract that to the 30GB boot partition. Most systems will allow you to select and boot such a drive from the boot menu, and then you cam locate the “windows partition” on the external drive (as it won’t contain Windows, for one!) and capture the FFU to that. You’ll find even with the most lowly of external hard disks the install should go a lot better than with USB key media, let alone that if you restore an image to skip the second stage of setup completely, and further if you really want overkill you can mount the boot.wim file on the 30Gb partiton, and use dism to add-driver hardware specific boot time mass storage drivers into the install boot, and get almost to a on disk restore in terms of speed (though to be honest we found no cases where the native UEFI drivers were so poor they didn’t work). At my previous employ we did that, but with SSDs in USB3 caddies, and it completely left the previous network imaging method in the lurch in speed terms so paid for itself in recouped time in weeks.

      • #2419820

        Install.wim is install.ESD on the entitlement downloads (same file, extracts with DISM)

        From the MCT ISO, they are not the same file, even though DISM works with both.  Install.esd contains more than one install.wim.

        Install.esd_

        I exported Index : 6 to get the Windows 10 Pro install.wim.

        Install.wim_

        As to generating that file, why bother?

        It’s handy.

        Always create a fresh drive image before making system changes/Windows updates; you may need to start over!
        We all have our own reasons for doing the things that we do with our systems; we don't need anyone's approval, and we don't all have to do the same things.
        We were all once "Average Users".

    • #2419899

      IMO you are more likely to have a disk/machine failure than a corrupt Windows file that causes problems and is actually replaceable via DISM etc.
      You could just make an image backup to an external disk and restore that if it goes pear shaped.

      cheers, Paul

      • #2419958

        IMO you are more likely to have a disk/machine failure than a corrupt Windows file that causes problems and is actually replaceable via DISM etc.

        In my experience that is not the case.  I’ve had my share of hardware failures, but I’ve had more corrupt system files than I have had hardware failures.

        You could just make an image backup to an external disk and restore that if it goes pear shaped.

        Only if that image is known goodThe same corrupt files can be in a drive image.

        Always create a fresh drive image before making system changes/Windows updates; you may need to start over!
        We all have our own reasons for doing the things that we do with our systems; we don't need anyone's approval, and we don't all have to do the same things.
        We were all once "Average Users".

    • #2419939

      I guess the method chosen basically depends on your backup philosophy then. Windows changes on a monthly basis but I can get that running in minutes so I tend to centre on backing up the tiny amounts of data I need to connect to the rest on line. Those who have to get back to “exactly as it was” are inherently going to take the opposite tack.

      I really wouldn’t bother fixing Windows if the reason for its demise isn’t obvious and the solution immediate, as there is so much behind the scenes you just can’t check easily, which is why I find recent firmware based malware exploits more concerning.

      I’m a bit bemused by your install media though – I guess it’s “retail”? (I’ve never seen Windows 10 with a install.WIM and only one product..) as the OEM one I used at (way back at 1903) had the same complement as the current ESD file of the time; we used an answer file to install the correct product from the set it contained in the file as you have listed, and added the OEM customisations (all done in Windows System Image Manager; part of the Windows SDK), the Microsoft instructions indicated it needed to be done that way so a “Windows anytime upgrade” could be leveraged from the local disk without downloading and installing a different product from Windows update. It’s probably irrelevant here, but noted that the image manager answer file doesn’t work if you unpack the install.WIM file.

      The process also negated the need to keep media for all Windows variants on hand (and it has been done that way since Windows 7, with Windows Vista OEM the “default” answer file inadvertently included in the OEM media made things more difficult. You had to remaster the media to start with, and to be honest even we skipped that OS.).

      We pretty quickly worked out how pointless it was using optical media, the install file set and answer file being stationed in a folder on the Windows partition of a pre-partitioned UEFI drive and fired with setup using the /unattend switch. The fun was you has to make sure the boot media was out of the picture before running setup if it was writeable, or Windows setup could set its BCD store on that instead. The headache was Windows 7 (no FFU option, no DISM imaging, all imagex with manual partitioning, individual partition images, and even getting busy with bootrec and bcdedit on some of the older configurations before UEFI became a default BIOS setting as the last thing you want is a default of CMOS settings leaving the machine unable to boot the OS.)

      In the same way, as an OEM you don’t actually need to download office 365 for every machine – you just need get the relevant install files for each build of Office product with the office deployment tool and preinstall the product; the final configuration and updates occur when the end user connects the product to their Office account with their credentials after logging in via their new Windows account, and synchronisation of any organisational Office configuration is completed via the account.

       

    • #2419942

      IMO there are generally two groups of people – those who kind of like the way computers are tweaked and software is bundled by OEMs (manufacturers) and those who feel that coming the closest to what Microsoft installs will be the most reliable.

      I’ve had the best luck being in the second group – dump everything the manufacturer gave you and use only what you get installing from a Microsoft ISO.  If a device does not work, then I will go to the manufacturer site to find a driver, but otherwise I stick to the ones that windows loads.

      One warning – I always boot from the manufacturer load first, to make sure that windows is activated online, and possibly associate the OS with an account, before wiping.  And backup hard drives are relatively cheap, so I often keep an image of the manufacturer recovery media although I would not prefer to use it. – BB

      • #2419960

        I really wouldn’t bother fixing Windows if the reason for its demise isn’t obvious and the solution immediate, as there is so much behind the scenes you just can’t check easily

        Windows as a platform can cause problems with the programs one uses without Windows having gone belly-up, just misbehaving.  The more one fixes Windows, the more obvious some solutions become.  For me, that’s a win-win.

        IMO there are generally two groups of people – those who kind of like the way computers are tweaked and software is bundled by OEMs (manufacturers) and those who feel that coming the closest to what Microsoft installs will be the most reliable.

        I’m DIY, use retail Windows installation media, so no OEM bloat to worry about.

        Always create a fresh drive image before making system changes/Windows updates; you may need to start over!
        We all have our own reasons for doing the things that we do with our systems; we don't need anyone's approval, and we don't all have to do the same things.
        We were all once "Average Users".

    • #2419965

      Why start with a Microsoft install? – the list of junk unsuitable for a business operating system Microsoft provide out of box is pretty extensive, and we found even with Office 365 and onedrive, you’re better  off ditching those out of box versions completely and installing the newest versions to avoid odd problems. The “onedrive for every user” was a real thorn in the 1803 LSP product as it basically allowed a data route to an insecure location as far as a main customer was concerned, and that same customer had a perpetual office license and one end user miss-click on a hot tile either got 365 installing and taking the file associations, or the customer calling the helpline wanting a password depending on their privileges..

      That said if reinstalling PNPUTIL is an easy route to get just the drivers off an OEM installation before you flatten it and install a Microsoft default saving you a few downloads.

       

      • #2419967

        Why start with a Microsoft install? – the list of junk unsuitable for a business operating system Microsoft provide out of box is pretty extensive

        Nothing I read in the OP even hinted at a business environment.  I don’t think that’s much of an issue in this thread.

        Always create a fresh drive image before making system changes/Windows updates; you may need to start over!
        We all have our own reasons for doing the things that we do with our systems; we don't need anyone's approval, and we don't all have to do the same things.
        We were all once "Average Users".

    • #2419973

      Why start with a Microsoft install? – the list of junk unsuitable for a business operating system Microsoft provide out of box is pretty extensive,

      A business should use Windows LTSC which is clean from all Microsoft’s “junk”

    • #2419984

      OK. Cleaned up and put the chickens to bed, and walked the dog. Now I think I’ve worked out why I’m not getting my point across..

      I think the confusion on ESD and WIM files resides in thinking a multi image archive is somehow inherently different than a single image archive- it’s pretty deep and revolves around the actual file content.. they are to intents the same things; you can have a WIM file with several images.. and if you change the file extensions, it makes no difference as DISM will attempt to process the files it is told to irrespective of that parameter – indeed some Acer hard disk restores did just that, and captured images with oddly sized image files named in a confusing sequence to obfuscate the content. Beware though – you can also span images so you can split an image to sections for DVDs for example – those are SWM and SFU files. (the latter is a split FFU, I haven’t seen one “in the wild” but as to what media that would be on I guess it would have to be a multi DVD set?!.) The first file of the set is always needed, subsequent files are useless without it.

      Wim files are not giant zip files of any description. Grossly simplified, DISM parses the files to be captured and creates a catalogue of name, size, version and position in the disk layout. A header of this is laid down, including data for aspects such as spanning, passwords and the like, and the process proceeds to process the catalogue, gathering only the actual binary file information into blocks of data (which can be size limited but to fit a disk size you have to guess how much the restore information will add to that to hit a target!) and compiling other information used to reconstruct the files later. At the end of the process the actual data’s parameters are compared to the parameters calculated at the cataloguing stage and if the two match the process is deemed to have completed (thus the need to test extract – it is mathematically possible to capture garbage that won’t restore though the chances are low.. I had it happen once in thousands of operations).

      Adding a subsequent image does NOT mean adding all the files in the next image to the archive. Dism loads the existing catalogue and determines the end of the data blocks, and then proceeds to process the new files being added (or to be removed) by the same criteria, but when building the data ONLY adding to the data blocks those where the where the name and location within the relative position in the image structure are the same, but the size, version information differs from the file already in the base image and all that information is added to the catalogue as a second image catalogue.

      In restoring dism processes the first image catalogue, and then applies the changes detailed for the second image in order to make the required changes to the final compiled catalogue of files to be placed by the process in order to successfully complete restoration of the requested image from that information. It is thus of primary importance to get the images into the archive in the right order or getting the later images can become time consuming, or the archive can get unwieldy in size and access time as much sifting of catalogues and unpacking many entire blocks to extract a few files takes more time than unpacking a contiguous image from one catalogue and a smaller number of blocks.

      There are also other layers of the operation. To be honest, that’s information I’d never use, but should want the exact structure and detail  it’s outlined in this download (yes, I know it says Vista and it’s old but guess what..) http://download.microsoft.com/download/f/e/f/fefdc36e-392d-4678-9e4e-771ffa2692ab/windows%20imaging%20file%20format.rtf#:~:text=A%20WIM%20file%20structure%20contains,file%20that%20contains%20two%20images.%20

      That is how (as I’m sure you’ve noticed) there can be 7 products which ought to be at least 4Gb a piece in an archive which originally distributed on a dual layer DVD.

      As to the assertion “it’s handy”, Yes you save time by unpacking the files, but you could do that when you need to (Windows 10 hasn’t broken on me yet and I install all the “bad” patches, but I don’t do anything complicated like printing and I certainly don’t have a virtual anything bar memory..)

      The alternative solution is to mount the image  taken as a backup (FFU images included) and simply copy the files from the mount point via command prompt (or back up a path with DISM and use that

      In using DISM that way, be aware that gets slow if done ineptly (CPU load is one issue, getting worse if you compress the data – which I generally don’t) that being the case even if you find enough areas for a /scratchdir specification for locations on separate devices for each command). Yes, the thought your having of me plugging in a second USB caddy simply to speed up the process that way is right. I appreciate the wonders of USB3 and flash drives but like to get the job done as well. Also having the scratchdir on the drive you’re imaging can result in more fragmentation than you might envisage, so specifying that parameter is good. “Be prepared”.

      The process of modifying a mounted image also lets you copy files out as well as in – just discard the  changes when you unmount the image (that’s important too!).. the details: https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/mount-and-modify-a-windows-image-using-dism?view=windows-11

       

    • #2420136

      OK the link to the document in the post has broken – it fails to load just as the link to that location on the Microsoft page does.

      Copy the link URL via a right click , ” paste and go to ..” the URL into the address bar of a new tab and the download will appear on the download bar (Chrome) – no idea why.

      I can’t attach the file, its a too large..

    Viewing 9 reply threads
    Reply To: Doing a clean install of Win10 21H2. How to generate a install.wim file?

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: