Update Windows 10 image with latest updates


  1. Posts : 77
    Windows 10
       #1

    Update Windows 10 image with latest updates


    As title says, i am trying find a way to update a Windows 10 image with the latest updates.
    I currently use a script like this:

    Code:
    • $mounted = (Get-Item "./Win10_21H1_EnglishInternational_x64.iso" | Mount-DiskImage -PassThru)
    • $drive = $mounted | Get-Volume
    • #Copy-Item -Recurse -Path "$($drive.DriveLetter):/" -Destination "./$($drive.FileSystemLabel)"
    • Mount-WindowsImage -ImagePath "./$($drive.FileSystemLabel)/sources/install.wim" -Path "./mnt" -Name "Windows 10 Pro"
    • $updates = Get-Item "./updates/w10/*"
    • foreach ($item in $updates) {
    • Add-WindowsPackage -PackagePath $item -Path "./mnt"
    • }
    • DISM /Cleanup-Image /Image:"./mnt" /StartComponentCleanup /ResetBase
    • Dismount-WindowsImage -Path "./mnt" -Save
    • Export-WindowsImage -ImagePath "./$($drive.FileSystemLabel)/sources/installcustom.wim" -Name "Windows 10 Pro" -CheckIntegrity
    And while it works it still seems there's some updates missing when i install it (i of course change the name of the wim file so it's replacing the install.wim)

    I grab the latest updates with
    Code:
    get-mscatalogupdate "windows 10 x64 21h1 cumulative"
    and grab the latest cumulative and .NET Framework update.

    Am i missing something?
    Should i use Dynamic Updates instead somehow? (looking at: https://docs.microsoft.com/en-us/win...dynamic-update)
      My Computer


  2. Posts : 425
    Windows 10
       #2

    Not particularly up to speed with power shell. I know, I need to pull the finger out :)

    So, still using DISM. It works for me.

    After downloading any pre-requisite SSUs and the latest CU that I want to integrate I grab my current ISO and mount it.
    Then copy the install.wim to a temp location (You can't update the mounted \sources\install.wim because it is read only).

    We will assume for this discussion that the win is in c:\temp, updates are in c:\updates and we are going to mount it in c:\mount

    If the image has multiple indexes you can use dism /get-wiminfo to list the indexes, and disk /get-wiminfo with /index:x (where x is the index you want info on), to get the current patch level.

    Mount the wim with dism /mount-wim /wimfile:c:\temp\install.wim /index:x /mountdir:C:\Mount

    You can then slipstream the updates with dism /image:C:\Mount /add-package /packagepath:c:\updates
    (you can have multiple updates in c:\updates and dism will process each of them).

    Watch out for pre-requisites. Dism will crash with error 800f0823 if there are dependencies that are not present.

    Once finished use dism /unmount-wim /mountdir:c:\mount /commit

    You will need to copy the mounted images files to a temp location, copy the updated wim to the sources folder, then use oscdimg to create the iso.

    That's probably somewhat bloated way of doing things, but I've done it monthly for some time now and it doesn't take long.

    EDIT: Windows will stack CUs so the install.wim will get big over time. Here's a site you might find useful: Optimizing Win10 OS Upgrade WIM Sizes | Mike's Tech Blog
      My Computer


  3. Posts : 4,601
    several
       #3

    I made a batch file to do similar for win7. It will probably work for win10/11 if I do a few edits.

    Update your Win 7 installation media - Page 53 - Windows 10 Forums
      My Computer


  4. Posts : 77
    Windows 10
    Thread Starter
       #4

    Oh didn't know you could just point /add-package /packagepath:folderwithupdates
    i used for loops and stuff for each package, that's really neat.

    But how do you find all the updates, i grab the latest CU as i said, but there's always more updates when i actually install it, but i can't figure out how to identify them beforehand (i am not counting drivers of course)
      My Computer


  5. Posts : 425
    Windows 10
       #5

    I use a combination of sources. Microsoft Update Catalog, BornCity, gHacks, and so on.

    For Windows update catalog you can just put in Windows 10 1909 and it will give them all to you in descending date order. Or you can just type .net 4.8 and it will give you all those patches. And so on.

    Each patch Tuesday lots of places go through all of the patches and give you the KB numbers, such as those listed above.

    But I run WSUS so I get all the patches listed automatically for me.
      My Computer


  6. Posts : 77
    Windows 10
    Thread Starter
       #6

    Thanks!
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 13:37.
Find Us




Windows 10 Forums