{"id":9033,"date":"2024-02-01T13:07:54","date_gmt":"2024-02-01T13:07:54","guid":{"rendered":"https:\/\/cheapwindowsvps.com\/blog\/step-by-step-guide-on-inserting-offline-msu-updates-into-windows-wim-images\/"},"modified":"2025-01-20T11:30:47","modified_gmt":"2025-01-20T11:30:47","slug":"step-by-step-guide-on-inserting-offline-msu-updates-into-windows-wim-images","status":"publish","type":"post","link":"https:\/\/cheapwindowsvps.com\/blog\/step-by-step-guide-on-inserting-offline-msu-updates-into-windows-wim-images\/","title":{"rendered":"Step-by-Step Guide on Inserting Offline .MSU Updates into Windows .WIM Images"},"content":{"rendered":"<div>Before deployment, Microsoft ISO&#8217;s install .wim or custom images should be updated. With the DISM module in PowerShell, you can add .msu updates, apps, and drivers to a Windows image offline without the need to boot it up.<\/div>\n<p>In principle, you can roll out outdated WIM archives because Windows Update subsequently downloads the patches to the live system. This occurs by default during installation unless <em>setup.exe<\/em> is called with the <em>\/dynamicupdate disable<\/em> switch or configured accordingly via <a href=\"https:\/\/4sysops.com\/archives\/setupconfig-ini-customizing-the-installation-of-windows-10-feature-updates\/\" target=\"_blank\" rel=\"nofollow noopener\">setupconfig.ini<\/a>.<\/p>\n<p>Delaying the update of Windows until after deployment or even later has several drawbacks. It increases the time needed for the OS installation or &#8211; if you wait until after the setup is complete &#8211; the computers are initially not protected by the latest patches. In addition, users must restart their PCs after applying the updates.<\/p>\n<h2>Extracting a WIM archive<\/h2>\n<p>We utilize an unaltered <em>install.wim<\/em> in our example, nonetheless, this process applies to all WIM archives. The file can be located in the <em>sources<\/em> directory of Microsoft&#8217;s ISO. After mounting the ISO as a virtual DVD drive, it&#8217;s advisable to copy it to a usable directory:<\/p>\n<pre>Mount-DiskImage C:Usersmeen-us_windows_11_business_editions_version_23h2_x64_dvd_a9092734.iso<\/pre>\n<h2>Read index of images from WIM archive<\/h2>\n<p>For offline image servicing, DISM or the cmdlets from the equivalent PowerShell module are suggested. Compared to the legacy utility, with its uneven syntax, the latter is considerably easier to use.<\/p>\n<p>The initial step is to show the contents of the WIM archive. This is important because it can contain multiple images, and you need the index of the image you want to mount:<\/p>\n<pre>Get-WindowsImage -ImagePath .install.wim | select ImageName, ImageIndex<\/pre>\n<p>Display the contents of a WIM archive with Get-WindowsImage.<\/p>\n<h2>Mount image<\/h2>\n<p>Once you have determined the index, you can mount the image for offline servicing with this command:<\/p>\n<pre>Mount-WindowsImage -Path .image -ImagePath .install.wim -Index 5 -CheckIntegrity<\/pre>\n<p>This mounts the image with index 5 (Windows 11 Pro) into the subdirectory <em>.image<\/em> and checks its integrity. If you have just extracted the WIM file from the installation media, you may encounter the following error message:<\/p>\n<p><em>Mount-WindowsImage: You do not have permissions to mount and modify this image.<\/em> Verify that you have <em>Read\/Write<\/em> permissions or mount the image using the <em>\/ReadOnly<\/em> option.<\/p>\n<div><a href=\"https:\/\/4sysops.com\/wp-content\/uploads\/2024\/01\/Mounting-install.wim-fails-due-to-the-read-only-attribute-of-the-file..png\" target=\"_blank\" rel=\"nofollow noopener\">Mounting install.wim fails due to the read-only attribute of the file.<\/a><\/div>\n<div>Mounting install.wim fails due to the read-only attribute of the file.<\/div>\n<p>The error message is misleading because insufficient permissions do not cause the issue. Instead, the WIM file&#8217;s read-only attribute is the culprit. You can remove this attribute with this command:<\/p>\n<pre>attrib -r install.wim<\/pre>\n<p>After successfully mounting the image, you can start installing the updates. These are usually downloaded in <em>.msu<\/em> or <em>.cab<\/em> format from the <em>Update Catalog<\/em>.<\/p>\n<div><a href=\"https:\/\/4sysops.com\/wp-content\/uploads\/2024\/01\/Download-missing-patches-from-the-Microsoft-Update-Catalog..png\" target=\"_blank\" rel=\"nofollow noopener\">Download missing patches from the Microsoft Update Catalog.<\/a><\/div>\n<h2>Integrate updates into the image<\/h2>\n<p>Our example deals with the latest cumulative update for Windows 11 x64. Use the following command to add it to the image:<\/p>\n<pre>Add-WindowsPackage -PackagePath .windows11.0-kb5031455-x64_[\u2026].msu -Path .image -LogLevel 3<\/pre>\n<p>This command incorporates the pathway to the update along with the directory where the image has been mounted. When a directory is specified instead of a file for the <em>PackagePath<\/em> parameter, it adds all <em>.msu<\/em> and .<em>cab <\/em>files stored in that directory to the image.<\/p>\n<p>A <em>LogLevel<\/em> of 3 logs errors, warnings, and info into the log file which by default is <em>%WINDIR%LogsDismdism.log<\/em>.<\/p>\n<p>You can also add updates using <a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/dism\/add-windowscapability?view=windowsserver2022-ps\" target=\"_blank\" rel=\"nofollow noopener\">Add-WindowsCapability<\/a> and <a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/dism\/add-windowsdriver?view=windowsserver2022-ps\" target=\"_blank\" rel=\"nofollow noopener\">Add-WindowsDriver<\/a> for the installation of optional features or drivers in the image. Likewise, for adding store apps that will be automatically installed for each new user on the computer, use <a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/dism\/add-appxprovisionedpackage?view=windowsserver2022-ps\" target=\"_blank\" rel=\"nofollow noopener\">Add-AppxProvisionedPackage<\/a>.<\/p>\n<p>To conclude, you can check if all desired packages are included in the image:<\/p>\n<pre>Get-WindowsPackage -Path .image | sort InstallTime -Descending | more<\/pre>\n<p>This command sorts the installed packages by installation date in descending order, displaying the most recently added packages first.<\/p>\n<h2>Unmount the image<\/h2>\n<p>Finally, you can save the updated image. To do this, either use <a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/dism\/save-windowsimage?view=windowsserver2022-ps\" target=\"_blank\" rel=\"nofollow noopener\">Save-WindowsImage<\/a> before you unmount the image or dismount it immediately and save it at the same time:<\/p>\n<pre>Dismount-WindowsImage -Path .image -Save -CheckIntegrity<\/pre>\n<p>In both cases, you can use the CheckIntegrity switch to verify the integrity of the image.<\/p>\n<h2>Summary<\/h2>\n<p>The cmdlets from the DISM module make it relatively straightforward to integrate updates, drivers, or apps into an installation image. Hence, it is unnecessary to boot the image, update it, and then generalize it again with <em>Sysprep<\/em>. Instead, these tasks can be performed offline by mounting the image.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Before deployment, Microsoft ISO&#8217;s install .wim or custom images should be updated. With the DISM module in PowerShell, you can add .msu updates, apps, and drivers to a Windows image offline without the need to boot it up. In principle, you can roll out outdated WIM archives because Windows Update subsequently downloads the patches to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-9033","post","type-post","status-publish","format-standard","hentry","category-blog"],"_links":{"self":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/posts\/9033","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/comments?post=9033"}],"version-history":[{"count":2,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/posts\/9033\/revisions"}],"predecessor-version":[{"id":10440,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/posts\/9033\/revisions\/10440"}],"wp:attachment":[{"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/media?parent=9033"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/categories?post=9033"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cheapwindowsvps.com\/blog\/wp-json\/wp\/v2\/tags?post=9033"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}