Editing wim images. How to open wim? Working with a DISM live image

To work with .wim archives, Windows includes the Dism utility (and the wimlib library is its open-source alternative).
Let's look at several typical tasks, first using the example of Dism version 6.1.7600 (built into Windows 7), then Dism version 10.0.14393 (built into Windows 10).

dism version 6.1.7600 can do nothing at all:
/Get-MountedWimInfo
/Get-WimInfo
/Commit-Wim
/Unmount-Wim
/Mount-Wim
/Remount-Wim
/Cleanup-Wim

List images in wim file

Dism /Get-WimInfo /WimFile:install.wim
For example install.wim from the installation windows disk 7 contains four images (it makes sense to pay attention to the Index and Name fields):

Deployment Image Servicing and Management tool Version: 6.1.7600.16385 Details for image: install.wim Index: 1 Name: Windows 7 HOMEBASIC Description: Windows 7 HOMEBASIC Size: 11,531,865,453 bytes Index: 2 Name: Windows 7 HOMEPREMIUM Description: Windows 7 HOMEPREMIUM Size: 12,045,241,621 bytes Index: 3 Name: Windows 7 PROFESSIONAL Description: Windows 7 PROFESSIONAL Size: 11,947,613,470 bytes Index: 4 Name: Windows 7 ULTIMATE Description: Windows 7 ULTIMATE Size: 12,110,440,566 bytes The operation completed successfully.

View image contents

To view the contents of the image, you need to mount it by index or name (name is too much of a distortion, so I’m giving an example only with the index):
Dism /Mount-Wim /WimFile:install.wim /index:3 /MountDir:C:\win7 /ReadOnly
With this command we mounted the "Windows 7 PROFESSIONAL" image into the C:\win7 directory. By default, the image is mounted writable, but the /ReadOnly switch sets the access mode to read-only.

Make changes to the image

1. Mount the desired image to change (without the /ReadOnly key):
Dism /Mount-Wim /WimFile:install.wim /index:3 /MountDir:C:\win7
2. Change/Replace/Add/Delete files in the C:\win7 directory as in any other.
3. Unmount the image saving the changes:
Dism /Unmount-Wim /MountDir:C:\Win7 /commit
or the same with two separate commands:
Dism /Commit-Wim /MountDir:C:\win7

Dism /Unmount-Wim /MountDir:C:\Win7 /discard

View a list of all mounted images (as well as their status)

Dism/Get-MountedWimInfo

Dism version 10.0.14393, among other things, can do the following:

/Split-Image
/Apply-Image

Split a wim file into several swm files

Wim - archive file type, it will not be possible to split it with some dd. But it will work out next command. It can be useful, for example, when you manually make an installation flash drive in FAT32 (this file system has a file size limit - a maximum of 4GB). The resulting swm files should be located in the sources directory. The FileSize key takes the size in megabytes.
Dism /Split-Image /ImageFile:install.wim /SWMFile:install.swm /FileSize:4096

Apply (unpack) the image to the file system
Dism /Apply-Image /Image-File:install.wim /Index:1 /ApplyDir:D:\ /EA
In the case of an archive divided into swm files, you must specify the file naming pattern.
Dism /Apply-Image /Image-File:install.swm /SWMFile:install*.swm /Index:1 /ApplyDir:D:\ /EA
The /EA switch instructs to set extended file attributes.

WIM: Applies a Windows Image (WIM) file or split Windows image(SWM) to a specific section.

This option does not support applying an image from a virtual hard drive(VHD), although you can use this command to apply images to a mounted, partitioned and formatted VHDX file.

/CheckIntegrity Detects and monitors WIM file corruption when used with write, unmount, export, and commit operations. /CheckIntegrity stops the operation if DISM detects that the .wim file is corrupt in the apply and connect operations.

/Verify checks for errors and duplicate files.

/NoRpFix disables reparse point tag fixing. A reparse point is a file that contains a link to another file in file system. If the parameter /NoRpFix not specified, reparse points pointing to paths outside the value specified /ImageFile, will not be recorded.

/SWMFile Allows you to specify a link to split WIM (SWM) files. pattern is a pattern for naming and locating split files. You can also specify wildcards. For example, the value E:\image\install*.swm applies all split files in the E:\image directory named install1.swm, install2.swm, etc.

/ConfirmTrustedFile Verifies the image to work with the Trusted Desktop on Windows 10, Windows 8.1, or Windows 8. This setting can only be used on a computer running at least WinPE 4.0.

Note

Using /Apply-Image with parameter /ConfirmTrustedFile in WinPE always add the parameter /ScratchDir, indicating the location of the physical media. This ensures that short file names are always available. Detailed description default behavior when using parameter /ScratchDir see section.

/WIMBoot Windows 8.1 only: Applies the Windows Image File Boot (WIMBoot) configuration to the image. This only applies to Windows 8.1 images that were burned or exported as a WIMBoot file.

Important

This feature is not supported on Windows 10.

/Compact: Applies the image in compact mode, saving space. Replaces WIMBoot. Windows 10 classic editions only (Home, Pro, Enterprise, and Education)

Dism /apply-image /imagefile:install.wim /index:1 /ApplyDir:D:\

Dism /apply-image /imagefile:install.swm /swmfile:install*.swm /index:1 /applydir:D:\

FFU: Applies an FFU image to the specified drive. For Windows 10 only.

This option does not support applying an image from a virtual hard disk (VHDX) file, but you can use this command to apply the entire image to a VHD.

/ImageFile specifies the path to the FFU file, for example: flash.ffu.

/ApplyDrive specifies the logical drive using DeviceID.

Getting the device ID:

    From the command line: wmic diskdrive list brief

    From drive C: system("wmic diskdrive list");

Note. The VHD may appear in the description with the name PhysicalDrive, such as \\.\PhysicalDrive2.

Use the parameter /SFUFile to provide a link to split FFU (SFU) files. This is a pattern for naming and distributing split files.

Use the parameter /SkipPlatformCheck, if the FFU file being applied is for a device other than the one on which the application is running. Required special file FFU.

DISM.exe /Apply-Ffu /ImageFile:flash.ffu /ApplyDrive:\\.\PhysicalDrive0

DISM.exe /Apply-Ffu /ImageFile:flash.sfu /SFUFile:flash*.sfu /ApplyDrive:\\.\PhysicalDrive0

Title (English): Windows Imaging Format File

Name (Russian): Windows installation image

Developer: Microsoft

Description: WIM or Windows Imaging Format File is a Windows installation image file format. The WIM format was developed by Microsoft. Such images can be used to install Windows, as well as to create modified images, such as the WinPe PE. WIM images contain a collection of operating system files placed in separate directories. Each subfolder has a serial number. The WIM file is usually located at boot disk in the sources directory. Typically, the WIM file is called boot.wim, but it may also be called install.wim. WIM differs from other images in that its smallest element is not a sector, as for example in ISO, but a file. Such images are also called file-oriented. In some cases, the WIM image may be split into several separate files with SWM extension.

You can use the following programs to open (edit) a file of this format.

To replicate a standard configuration on several computers, it is rational to use an image of a once installed operating system.

Detailed instructions are available on the Microsoft website: Creating and using Windows images

Since with a large set of additional software, the partition image file can easily exceed 4GB, then write such a distribution to DVD disc it won't work. However, this is not required to install the OS. It will be enough for us to obtain an image of the partition on which the OS is installed. It can then be included in the boot distribution Flash disk or just transfer to new computer, booting from any live-CD/DVD/USB. In this article we will look at both options.

Having prepared the partition once, we will be able to deploy a working OS with all installed software, connected peripheral devices and necessary shortcuts on new computers in less than half an hour.

According to Microsoft: "When creating an image, be aware that the partition layout on the source and destination computers must be identical. For example, if the Windows image is stored on drive D, you must also deploy this image to drive D of the destination computer, and the following partition settings must also match ():

  1. Partition types (primary, secondary or logical) must match
  2. If a partition is made active on the reference computer, it must also be active on the target computer."

However, if we add a prepared partition to the distribution, then these restrictions do not matter.

Step-by-step instructions for deploying Windows 7 from an image

1. We do a template installation of Windows in audit mode

5. Write the created partition image to the local hard drive

E:\tools\imagex.exe /apply E:\images\win7image.wim 1 C: WITH:- the section where we will deploy the image 1 - number (or name) of the image, default = 1

If the OS images are located on a network resource, then connect it first with the command:

Net use E: \\server\share /user: domain_name\username password

6. Completion

If you created a separate system partition, then you need to transfer bootloaders to it system files(assuming the OS is located on the C: drive):

Bcdboot C:\Windows

Exit Windows PE:

or close the window Windows installer 7. The computer will reboot. We take out the CD/DVD disk and boot from the newly installed OS.

7. Complications

  • If you encounter problems loading the transferred OS, you can try restoring the bootloader. To do this, you need to boot from the Windows 7 distribution (you can open the console by pressing Shift+F10) or Windows PE and run the command:
bcdboot C:\Windows /l ru-RU /s C: Read more in the article "Restoring the Windows and Linux bootloader".

Repository of various Windows images

You can create several images of partitions with different sets of software, using the same template OS, then place them in one place, for example on a flash drive, and each time install exactly the image that will be suitable in each individual case. The process of adding software can be carried out sequentially by doing new image section after installing each required set. The algorithm is as follows (see details above):

  1. Loading the OS in audit mode
  2. Install/remove software, connect printers, create shortcuts, etc.
  3. We prepare the system for deployment using sysprep and turn off the computer
  4. Booting from live CD or Windows7 distribution, go to console
  5. Create a partition image using imagex by placing it on a flash drive or network resource
  6. We repeat the above until all the necessary sets have been created.

Creating your own Windows distribution

Having an image Windows partition(wim file), you can create your own distribution, that is, an installation DVD/Flash disk. To do this, it is enough to replace the \sources\install.wim file in the original distribution with your own image, renaming it accordingly to install.wim.

To automate the installation, you can prepare an autounattend.xml answer file by creating it using WIAK and placing it in the root of the distribution.

In this lesson we import wim file. For those who don't know, this is disk image format. It was developed by Microsoft for deployment latest releases operating systems families Windows(Vista, 7, 8). Systems use this file as part of the standard installation procedure. For those who have just started reading my blog, I recommend that you first read the first article in this series and perform all the steps to create a flash drive in the order in which new articles are published. The main thing is not to rush and do everything gradually. Well, for the rest of you, I offer you this article.

Step 1. We mount the original image of Win 7 x86 (x64) into the system and configure the connection when the power is turned on.

Step 2. Let's start the virtual machine. We go into the BIOS (by pressing the key F2 at startup) and set the boot from CD-ROM. Let's save (F10).

Step 3. When the message “Press any key to boot from CD or DVD...” appears, press any key.

Step 4. The system displays a window with a choice of language. But we press on Shift+F10.

Step 5. In the appeared command line enter c:

Step 6. Then dir

Step 7 Now d: and again dir

Step 9 And again dir

class="eliadunit">

Step 10 We are interested in imagex.exe. Next we enter the following d:\x86\imagex.exe /capture c: d:\install.wim /flags “Professional” “Windows 7 SP1 Professional” “Windows 7 SP1 Professional” /compress maximum and press ENTER

Step 11 The utility has started.

Step 12 We do everything similarly on a 64-bit OS. The only difference is in the team. X86 changes to amd64.

Step 13 After finishing the work, turn off the machines.

Step 14

Step 15 Import the wim file into the host system. To do this, let's go to Options virtual machine and find the tab HDD. We look at the name of the disk file.

Step 16 Go to File-Mount virtual disks-Connect-Browse-Specify the disk file with the name above-Select to connect the second partition-Ok-Ok.

Step 17 Finding the file install.wim, cut it out and put it in a folder \SystemFlash\Sborki\Win7x86_wim.


Top