OSDWindowsImage

David Segura @SeguraOSD

There aren't many days that I don't mount a WIM file ... which is where these two functions will become my primary tools

Before you start playing around with this, make sure you update the OSD Module to 19.11.22 or newer and that you have the OSDSUS Module installed and updated ...

Functions

Mount-WindowsImage

Mount-OSDWindowsImage is based off of Mount-WindowsImage. So why the need for a new function? Here's a few reasons

  • I can't just specify a WIM

  • I have to specify an Index

  • My Path (Mount Directory) needs to exist

Mount-OSDWindowsImage

For starters, all you need to provide is a WIM (Position 0). There is no need to specify an Index as Index 1 is assumed if one is not provided.

Mount WIM

The WIM is mounted to a Random directory in $env:TEMP. This directory is automatically created

Mount and Explore

And finally, the Explorer parameter will automatically open Windows Explorer to the Mount Path

Update-OSDWindowsImage

Finally this is the gem for those of you that Hate OSDBuilder. You will need an up to date OSDSUS for this to work properly

Windows Image Mount Path Is Optional

Yes Boys and Girls, this is quite a treat. Simply run the function without any Parameters. If you have a Mounted Windows Image, it will find it ... and let you know if it needs any updates

Multiple Windows Images - Mounted

Ok, did I just mount three WIMS in a single command line? Ok, now I'm just showing off ... but as you can see, Update-OSDWindowsImage will find all three and give me an update

Multiple Windows Images - Mount | Update | Dismount

If you thought that was it ... yes you can use this in the Pipeline

Install Updates

OK, I think you get the idea of the different ways you can use it ... so let's focus on the Updates. You can use these Update values

  • Check (Default)

  • All

  • SSU

  • LCU

  • DotNet

  • DotNetCU

And there's even a BitsTransfer parameter too!

One-Liner

So here is your PowerShell One-Liner to Mount, Identify the OS, Identify the Required Updates, Download the Updates, Apply the Updates, and finally, Dismount and Save an Install.wim. This by far makes the shortest WIM Update script ever. Enjoy!

Mount-OSDWindowsImage T:\WimOS\install.wim | Update-OSDWindowsImage -Update All | Dismount-WindowsImage -Save

Or you can Script the solution for better readability

Downloads and Logs

If you need the Downloads and Logs (you know how I am about Log files), simply look in $env:TEMP\OSD

OSD Helper Functions

Finally some other functions from the OSD Module were used to make this all work

Identify the Mounted OS Information

pageGet-RegCurrentVersion

Identify the Installed Updates

pageGet-SessionsXml

Download the Updates

pageSave-OSDDownload

Last updated