System Center Configuration Manager can be used for offline injection of updates into the install.wim file within a Windows Server ISO. The newly updated install.wim file can be used with SCCM as part of a operating system image, or it can be baked into an ISO to produce a “slipstreamed” ISO containing most of the available Microsoft hotfixes.
One notable twist to this is that a Windows Server 2008 R2 or Windows Server 2012 R2 ISO actually contains multiple images for the different flavors of a server installation. This post talks about the steps to follow to reduce the ISO to a single image for a specific purpose, then update that image with hotfixes using System Center Configuration Manager’s Offline Servicing function.
What I did to create an updated Windows Server 2012 R2 Datacenter image
I downloaded the Windows Server 2012 R2 Datacenter ISO from the Microsoft Volume Licensing Service Center, and got an approximately 5 GB file named “SW_DVD9_Windows_Svr_Std_and_DataCtr_2012_R2_64Bit_English_-4_MLF_X19-82891.ISO”.
I then mounted the ISO with Virtual Clone Drive and used Robocopy to copy the install.wim file from the \sources\ directory to a network location. I viewed the properties of the install.wim file on the network location and unchecked the box to remove the Read-only attribute.
I added the install.wim file to SCCM using the Add Operating System Image function.
Once the WIM file was in SCCM, I was able to look at the information about the file. From the Operating System Images node, I selected the newly added WIM and under the Details tab, I noted that this ISO contains 4 images:
Windows Server 2012 R2 SERVERSTANDARDCORE
Windows Server 2012 R2 SERVERSTANDARD
Windows Server 2012 R2 SERVERDATACENTERCORE
Windows Server 2012 R2 SERVERDATACENTER
This is all fine and good, but running SCCM’s Offine Servicing feature against a WIM will apply CBS updates to each image that it finds, which isn’t what I need or want. All I’m interested in is a fully patched WIM that will install Windows Server 2012 R2 Datacenter during a task sequence.
So, to avoid applying CBS updates multiple times to the WIM, and to keep the size of the patched install.wim file down, I need to remove the unwanted images from the WIM before I perform the Offline Servicing. Below are the steps to do this:
Open an elevated command prompt and type:
DISM
You’ll get the DISM help text. You’ll need to be able to see the commands /Get-ImageInfo and /Delete-Image. (I believe that these additional commands come with the installation of the Windows ADK. In any event, they were present on my SCCM server but absent from my Windows 10 workstation.)
From the elevated command prompt, type:
DISM.exe /Get-ImageInfo /ImageFile:"<path-to-install.wim-file>"
Note that UNC paths are acceptable.
The output of this command should provide some information on each image. The Windows Server 2012 R2 SERVERDATACENTER image index number is 4.
To delete an image from the file, we specify the index of the image to be deleted.
From the elevated command prompt, use the /Delete-Image command. For example, to delete the image at index “1”, type:
DISM.exe /Delete-Image /ImageFile:"<path-to-install.wim-file>" /Index:1
Run the DISM.exe /Get-ImageInfo /ImageFile:"<path-to-install.wim-file>"
command again, and note that the index numbers have shifted. The Datacenter image index number is now 3.
Run the DISM.exe /Delete-Image /ImageFile:"<path-to-install.wim-file>" /Index:1
command, adjusting the index number as needed, until only the Datacenter image remains.
Now we need to tell SCCM to reload the WIM file to recognize our changes.
Right-click on WIM object in the Operating System Image node in SCCM and choose Properties. Select the Images tab and then click the Reload button. The list of images will be refreshed and the Datacenter image should become the only image in the list.
While in the Properties, I also visit the Data Source tab and check the box for Enable binary differential replication (Microsoft’s System Center Configuration Manager RAP assessment tool flags this as a best practice).
Click OK to close the Properties window.
Right-click on the WIM object again and choose Schedule Updates, then proceed through the Schedule Updates Wizard.
After this has finished, the install.wim file will have been updated and a backup of the original install.wim file will exist in the same directory.