Use DISM in UEFI mode to grab WIN 10 2019 LTSC system image and restore

The purpose of the experiment:
first install WIN10 2019 LTSC operating system on a new Dell 7460 all-in-one machine without operating system, then try to use DISM to capture its operating system as a WIM image, and finally manually deploy this image to other PCs of the same model (or Local).

Experimental environment:
● At least one DELL 7460 all-in-one machine (without optional internal optical drive);
● A USB external optical drive, a WIN10 2019 LTSC installation CD (to facilitate the first new installation);
● An idle U disk with a capacity of not less than 2G (All data will be cleared during the experiment), a 500G notebook mobile hard disk (NTFS format. The total hard disk capacity does not really matter, but it is recommended that the free space is not less than 20G, the larger the better. I tested it here. The new empty system is finished with the default After the patch is installed, the driver is grabbed and it is about 6G).
● One working PC with WIN10 operating system installed, can access the Internet.

Explain a little, because it is UEFI boot, so the boot U disk needs to be made into FAT32 format. However, in the FAT32 format, the size of a single file cannot exceed 4G, and the captured image will almost certainly exceed 4G, so an additional NTFS storage is required to save this image. For this reason, we need a U disk, a removable hard drive in NTFS format.

Preparation before the experiment:
1. Download and install the ADK on the working machine. https://docs.microsoft.com/zh-cn/windows-hardware/get-started/adk-install ; Although the Setup file looks small, the rest must be downloaded online. It is recommended to download to a local directory to facilitate the next installation or share it with other computers;
2. Our goal is to verify the manual DISM deployment method, so only the PE environment and deployment tools need to be installed.
3. Make WIN10 PE.
    a. Start the "Deployment and Imaging Tool Environment". After entering, run the command line:
        copype amd64 d: \ win10pe.x64 The
        first parameter indicates that the 64-bit PE is to be prepared, and the second parameter indicates that the working directory is located at d: \ win10pe.x64. This directory must not exist yet.
    b. Make ISO:
        makewinpemedia / iso d: \ win10pe.x64 d: \ temp \ win10pe-x64.iso The
        second parameter is the temporary working directory just specified, and the third parameter specifies where the final output ISO file is.
Then copy the PE in the same way as the Windows installation USB disk. You can refer to the relevant content in the following link: https://blog.csdn.net/ki1381/article/details/8896616
Once again, in order to adapt to UEFI, fat32 must be used when PE starts U disk formatting.
4. Create the following file in the mobile hard disk (or U disk), named disk0.txt:
select disk 0
clean
convert gpt

create partition primary size=512
format quick fs=ntfs label="Windows RE tools"
set id=”de94bba4-06d1-4d40-a16a-bfd50179d6ac”
gpt attributes=0x8000000000000001

create partition efi size=128
format quick fs=fat32 label="System"
assign letter="S"

create partition msr size=16

create partition primary
format quick fs=ntfs label="Windows"
assign letter="W"

The ID and GPT attributes are set for the first partition, and it changes from a normal primary partition to a protected hidden Recovery partition.

Step 1: Install the template machine
1. Turn on the DELL 7460 and confirm the pure UEFI startup mode. Use a USB external optical drive to install the WIN10 2019 LTSC operating system normally.
2. Use automatic update for system update and driver installation;
3. Install other required software;
4. After confirming that the system will not be changed, run PowerShell as an administrator and run:
Cd% windir% \ system32 \ sysprep
. \ Sysprep / generalize / oobe / shutdown
Do not start from the internal hard disk after shutdown .

Step two: grab the mirror:
general idea: boot the system with PE, and use the diskpart command environment to assign drive letters to the Windows partition of the mobile hard disk and the built-in hard disk (usually considered C drive), and then capture the "C drive" as a mirror And store it on the mobile hard disk.
1. Insert the U disk and mobile hard disk, and boot from the U disk.
2. Enter the PE command line interface and run DISKPART.
3. We first find the drive letter of the mobile hard disk. Run List volume view in DISKPART environment. Suppose the drive letter of the mobile hard disk is F. If you want to change the drive letter or the mobile hard disk is not assigned by the PE system, you can run the following commands in sequence:
List disk
Select disk 1 Assuming that the mobile hard disk is disk 1
Select partition = 1 Assuming that this hard disk has only one partition;
Assign letter = F

4. Assign a drive letter to the Windows partition on the internal hard disk:
Select disk 0
List partition
Select partition = 4 Please confirm the actual ID of the patittion
Assign letter = W

5. Capture image
DISM / Capture-Image /ImageFile:F:\win10-2019.wim / CaptureDir: W: \ / Name: WIN10

Step 3: Restore the image
General idea: Boot from PE, and use the diskpart command environment to partition and assign drive letters to the internal hard disk, and also assign drive letters to the mobile hard disk. Then restore the wim file on the mobile hard disk to the target partition, and finally transfer and set the startup file.
1. Boot from the U disk to enter the PE environment and start the diskpart;
2. Refer to step 3 of step 2 to find the drive letter of the mobile hard disk (or U disk. The disk storing the Disk0.txt script shall prevail). Suppose the drive letter is F;
3. Confirm that the internal hard disk is disk 0. Exit diskpart, and then run diskpart / s F: \ disk0.txt. Confirm that the partition is successful;
4. Note that the temporary drive letter of the "C drive" to be restored in the script is W. Run the command:
DISM / Apply-Image /ImageFile:F:\win10-2019.wim / index: 1 / ApplyDir: W: \
5. Run bcdboot W: \ windows / l zh-cn under x: \ windows \ system32

After confirming that it is correct, you can call the exit command and restart. Remove the external USB device, if everything is normal, you will enter the Windows being reset!

Reference materials:
https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/windows-deployment-sample-scripts-sxs#CreatePartitions-_firmware_.txt
https://docs.microsoft.com/ en-us / windows-hardware / manufacture / desktop / deploy-windows-re
https://blog.csdn.net/ki1381/article/details/76886878

Published 122 original articles · Like 61 · Visits 530,000+

Guess you like

Origin blog.csdn.net/ki1381/article/details/87117670