Lokateu,
Apologies for being so slow to respond. I've been attending to other things and now catching up on TenForums.
Attached is a PDF document - a small portion of my notes, but this has all the instructions that you need to completely update your Windows images.
Note that this is a lot of work to do manually, but at least you will know how to do it. Be aware that this entire process will update ONE Windows edition from your media. If you want to update multiple editions (for example Home, Professional, Education edition, etc.) then this process needs to be repeated for each edition.
You will also find a batch file below that automates the entire process. Just make sure to open the batch file in something like notepad first to read the usage instructions at the beginning. Note that this batch file will also update ONE edition of your choosing. To update multiple editions you need to run the batch file multiple times.
Last, here is a link to my program that completely automates the entire process. This process is only one small part of what the program can do, but it will handle everything including updating multiple editions. So, let's assume that you have an ISO image with 10 editions of Windows on it and you want to update them all. This program can do that for you and assemble them all back into a single ISO image again. You can even combine both x64 and x86 editions of Windows in the same ISO image. When you run the program, the option to add all your updates to the Windows image is item #1 from the menu.
Microsoft OneDrive - Access files anywhere. Create docs with free Office Online.
NOTE: If you pull down my program, make sure to check back occasionally because I do tend to update the program fairly regularly. Also, at the same link above you will find my entire documentation set of which the attached PDF is simply a small part.
Updating Windows Images with Latest Updates.pdf
Below is the batch file to automate installation of Windows updates. Open in notepad and read instructions first!
Code:
:: PURPOSE OF THIS SCRIPT
::
:: This script will take one Windows edition in a Windows ISO image and inject Windows updates into it. The
:: updated edition of Windows will be saved to a new file containing just that one edition of Windows.
:: FOLLOW THESE INSTRUCTIONS
::
:: 1) Read the instructions below the title header below to learn how to setup folders this project will need.
::
:: 2) Review the "User defined variables" section below and modify as needed.
::
:: 3) Make sure that you have the Windows ADK installed. Only the Deployment Tools from the ADK need to be installed.
::
:: 4) From the ADK, launch an elevated Deployment and Imaging Tools Environment and run this batch file from there.
@echo off
cls
::::::::::::::::::::::::::::::::::::::
:: Windows Image Updater ::
:: ::
:: Version 1.02 ::
:: ::
:: Jan 21, 2021 by Hannes Sehestedt ::
::::::::::::::::::::::::::::::::::::::
:: Create the following folders before you run this batch file.
::
:: NOTE: The paths below assume the default settings of user defined variables. If you change those variables,
:: Please alter the below paths accordingly.
::
:: Create a folder C:\Project\ISO_Files and copy the entire contents of a Windows ISO image to this folder.
::
:: Create the following folders:
::
:: C:\WinUpdates\LCU <--- Place the Latest Cumulative Update in this folder
:: C:\WinUpdates\Other <--- Place other updates (for example .NET Updates) in this folder
:: C:\WinUpdates\SafeOS_DU <--- Place the latest Safe OS Dynamic Update in this folder
:: C:\WinUpdates\Setup_DU <--- Place the latest Setup Dynamic Update in this folder.
:: C:\WinUpdates\SSU <--- Place the latest Servicing Stack Update in this folder
:: C:\WinUpdates\PE_Files <--- Place any files such as scripts that you want copied to WinPE here. See note below.
::
:: NOTE: The PE_Files noted above can be used to place files that you want to copy to Windows setup. For example, I have a couple of scripts
:: that I want to be available to Windows setup. Any files that you place here will be availale on drive X: during windows setup. Note
:: that X: is the RAM Drive that Windows creates during setup. Since this is just about the first thing setup does, these files will
:: be available very early in setup.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: User defined variables::
:::::::::::::::::::::::::::
:: Set to the index number corresponding to the Windows edition you want to update. By default, I specify Index 6 below which is usually Win 10 Pro.
set IndexNum=6
:: Set to the location where the project will be created. Place your extracted ISO image files in a subfolder of this location called \ISO_Files
set ProjectFolder=C:\Project
:: Set to location of Windows updates. Under this folder, create the subfolders LCU, Other, SafeOS_DU, Setup_DU, SSU, and PE_Files as described above.
set WinUpdates=C:\WinUpdates
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo ***************************************************************
echo ***************************************************************
echo ** PLEASE BE PATIENT! Applying updates is a lengthy process! **
echo ***************************************************************
echo ***************************************************************
echo.
:: Create the initial directory structure for this project
md %ProjectFolder%\Mount > NUL 2>&1
md %ProjectFolder%\WinRE > NUL 2>&1
md %ProjectFolder%\WinRE_Mount > NUL 2>&1
md %ProjectFolder%\WinPE > NUL 2>&1
md %ProjectFolder%\WinPE_Mount > NUL 2>&1
md %ProjectFolder%\Assets > NUL 2>&1
md %ProjectFolder%\Temp > NUL 2>&1
md %ProjectFolder%\Base > NUL 2>&1
:: Copy the ISO image files to base folder
echo ****************************************
echo * Copy Windows files to working folder *
echo ****************************************
echo.
robocopy "%ProjectFolder%\ISO_Files" "%ProjectFolder%\Base" /mir > NUL
:: Mount the install.wim file
echo ****************************
echo * Mounting the install.wim *
echo ****************************
echo.
DISM /mount-image /imagefile:"%ProjectFolder%\Base\sources\install.wim" /index:%IndexNum% /mountdir:"%ProjectFolder%\Mount" > NUL
:: Update Win RE
echo ******************
echo * Updating WinRE *
echo ******************
echo.
copy /B %ProjectFolder%\Mount\Windows\System32\Recovery %ProjectFolder%\WinRE > NUL
DISM /mount-image /imagefile:"%ProjectFolder%\WinRE\WinRE.wim" /index:1 /mountdir:"%ProjectFolder%\WinRE_Mount" > NUL
DISM /Add-Package /Image:"%ProjectFolder%\WinRE_Mount" /PackagePath="%WinUpdates%\SSU" > NUL
DISM /Add-Package /Image:"%ProjectFolder%\WinRE_Mount" /PackagePath="%WinUpdates%\SafeOS_DU" > NUL
DISM /Cleanup-Image /Image:"%ProjectFolder%\WinRE_Mount" /StartComponentCleanup > NUL
DISM /Unmount-Image /MountDir:"%ProjectFolder%\WinRE_Mount" /Commit > NUL
DISM /Export-Image /SourceImageFile:"%ProjectFolder%\WinRE\WinRE.wim" /SourceIndex:1 /DestinationImageFile:"%ProjectFolder%\Assets\WinRE.wim" > NUL
:: Update WinPE
echo *****************************
echo * Updating boot.wim Index 1 *
echo *****************************
echo.
copy /B "%ProjectFolder%\Base\sources\boot.wim" "%ProjectFolder%\WinPE" > NUL
DISM /mount-image /imagefile:"%ProjectFolder%\WinPE\boot.wim" /index:1 /mountdir:"%ProjectFolder%\WinPE_Mount" > NUL
DISM /Add-Package /Image:"%ProjectFolder%\WinPE_Mount" /PackagePath="%WinUpdates%\SSU" > NUL
DISM /Add-Package /Image:"%ProjectFolder%\WinPE_Mount" /PackagePath="%WinUpdates%\LCU" > NUL
DISM /Cleanup-Image /Image:"%ProjectFolder%\WinPE_Mount" /StartComponentCleanup > NUL
DISM /Unmount-Image /MountDir:"%ProjectFolder%\WinPE_Mount" /Commit > NUL
DISM /Export-Image /SourceImageFile:"%ProjectFolder%\WinPE\boot.wim" /SourceIndex:1 /DestinationImageFile:"%ProjectFolder%\Assets\boot.wim" > NUL
echo *****************************
echo * Updating boot.wim Index 2 *
echo *****************************
echo.
DISM /mount-image /imagefile:"%ProjectFolder%\WinPE\boot.wim" /index:2 /mountdir:"%ProjectFolder%\WinPE_Mount" > NUL
DISM /Add-Package /Image:"%ProjectFolder%\WinPE_Mount" /PackagePath="%WinUpdates%\SSU" > NUL
DISM /Add-Package /Image:"%ProjectFolder%\WinPE_Mount" /PackagePath="%WinUpdates%\LCU" > NUL
:: Copy user files, such as scripts, to WinPE
robocopy "%ProjectFolder%\PE_Files" "%ProjectFolder%\WinPE_Mount" *.* > NUL
:: If you want to delete files from WinPE, such as scripts you may have added previously, uncommet the
:: line below and change the filename to the name of the file you want to delete. Add additional lines using
:: the same format if needed.
:: del "%ProjectFolder%\WinPE_Mount\MyScript.bat" /Q > NUL
DISM /Cleanup-Image /Image:"%ProjectFolder%\WinPE_Mount" /StartComponentCleanup > NUL
:: We are going to delay exporting of the boot.wim index 2 until later so that we can copy files while
:: it is still mounted to the main media. We could this right now, but by delaying it until after the
:: Setup Dynamic Update is applied, we can demonstrate that there are files that are out of sync after
:: all updates, including the Setup Dynamic Update, have been applied.
:: Update install.wim
echo ************************
echo * Updating install.wim *
echo ************************
echo.
DISM /Add-Package /Image:"%ProjectFolder%\Mount" /PackagePath="%WinUpdates%\SSU" > NUL
DISM /Add-Package /Image:"%ProjectFolder%\Mount" /PackagePath="%WinUpdates%\LCU" > NUL
echo ********************************************************************************************
echo * Copy updated winre.wim back into mounted install.wim and perform cleanup on install.wim *
echo ********************************************************************************************
echo.
copy /B "%ProjectFolder%\Assets\WinRE.wim" "%ProjectFolder%\Mount\Windows\System32\Recovery" /y > NUL
DISM /Cleanup-Image /Image:"%ProjectFolder%\Mount" /StartComponentCleanup /ResetBase /ScratchDir:"%ProjectFolder%\Temp" > NUL
:: Install "Other" Updates (for example, .NET updates)
echo ****************************************
echo * Install "Other" updates such as .NET *
echo ****************************************
echo.
DISM /Add-Package /Image:"%ProjectFolder%\Mount" /PackagePath="%WinUpdates%\Other" > NUL
:: We could copy files from the mounted install.wim now as part of the fix to the issue that I reported, but just as
:: with the boot.wim we will delay doing so until after the Setup Dynamic Update has been applied.
:: Install the setup dynamic update
echo ******************************
echo * Apply Setup Dynamic Update *
echo ******************************
echo.
Expand "%WinUpdates%\Setup_DU\*" -F:* "%ProjectFolder%\Base\Sources" > NUL
echo **************************************************
echo * Copy mismatched files to appropriate locations *
echo **************************************************
echo.
:: The 4 robocopy commands below work around a problem with the Windows update process. Files in the boot.wim have exact duplicate
:: files in other locations on the media. The problem is that the files in the boot.wim get updated, but the other copy of these
:: files do not. This leads to media which may not function properly and from which it may not be possible to install Windows. The
:: robocopy commands below resolve this issue by taking files in the boot.wim that are newer than the duplicates and copying them
:: over the files that were not updated.
robocopy "%ProjectFolder%\winpe_mount" "%ProjectFolder%\Base" setup.exe /xo /xx /xl /r:0 /w:0 /njh /njs > NUL
robocopy "%ProjectFolder%\winpe_mount\sources" "%ProjectFolder%\Base\sources" setup.exe /xo /xx /xl /r:0 /w:0 /njh /njs > NUL
robocopy "%ProjectFolder%\winpe_mount\windows\system32" "%ProjectFolder%\Base\sources" *.* /e /ndl /xo /xx /xl /np /r:0 /w:0 /njh /njs > NUL
robocopy "%ProjectFolder%\mount\windows\system32" "%ProjectFolder%\Base\sources" *.* /e /ndl /xo /xx /xl /np /r:0 /w:0 /njh /njs > NUL
echo ************************************************
echo * Unmounting and exporting index 2 of boot.wim *
echo ************************************************
echo.
DISM /Unmount-Image /MountDir:"%ProjectFolder%\WinPE_Mount" /Commit > NUL
DISM /Export-Image /Bootable /SourceImageFile:"%ProjectFolder%\WinPE\boot.wim" /SourceIndex:2 /DestinationImageFile:"%ProjectFolder%\Assets\boot.wim" > NUL
echo ****************************************
echo * Unmounting and exporting install.wim *
echo ****************************************
echo.
DISM /Unmount-Image /MountDir:"%ProjectFolder%\Mount" /Commit > NUL
DISM /Export-Image /SourceImageFile:"%ProjectFolder%\Base\sources\install.wim" /SourceIndex:%IndexNum% /DestinationImageFile:"%ProjectFolder%\Assets\install.wim" > NUL
echo *********************************************************************************
echo * Copy updated boot.wim and install.wim image folder and create final ISO image *
echo *********************************************************************************
echo.
copy /B "%ProjectFolder%\Assets\boot.wim" "%ProjectFolder%\Base\Sources" /Y > NUL
copy /B "%ProjectFolder%\Assets\install.wim" "%ProjectFolder%\Base\Sources" /Y > NUL
oscdimg.exe -m -o -u2 -udfver102 -bootdata:2#p0,e,b%ProjectFolder%\Base\boot\etfsboot.com#pEF,e,b%ProjectFolder%\Base\efi\microsoft\boot\efisys.bin %ProjectFolder%\Base %ProjectFolder%\Win10_Updated.iso > NUL 2>&1
:: Cleanup the temporary folders.
rd %ProjectFolder%\Mount /s /q > NUL
rd %ProjectFolder%\winre /s /q > NUL
rd %ProjectFolder%\winre_mount /s /q > NUL
rd %ProjectFolder%\winpe /s /q > NUL
rd %ProjectFolder%\winpe_mount /s /q > NUL
rd %ProjectFolder%\assets /s /q > NUL
rd %ProjectFolder%\temp /s /q > NUL
rd %ProjectFolder%\Base /s /q > NUL
echo Done! The ISO image has been saved as "%ProjectFolder%\Win10_Updated.iso"
echo.