Disclaimer: All information and content in this blog posts is provided without any warranty whatsoever. The entire risk of using this information or executing the provided content remains with you. Under no circumstances should Dell, Microsoft, its author, or anyone else involved in the creation of these blog posts be held liable for any damage or data loss.
Disclaimer: Do NOT create a WIM from files located on a dedup volume! Really bad things WILL happen! The ConfigMgr overlords (Mike & Gary) will punish those of us who did it anyway! - You have been warned!
Knowledge: I assume that people who read this blog post has an general understanding of application creation in Microsoft Endpoint Configuration Manager, so I won't be deep-diving into details about that in this post.
WIM YOUR APPLICATIONS
Introduction
For several years I've built huge applications of 10-20 GB in size (Hashtag Autodesk) with a long deployment time to follow for the end user. For all those years I been wanting to come up with a solution to reduce the size of the applications and deployment time.
Let´s WIM Your Applications Like a Boss!
Then earlier this year I was inspired by Martin Bengtsson and his blog post about capturing drivers into a WIM format and *BINGO* then came the idea to build a PowerShell script to handle WIM applications in our Microsoft Endpoint Configuration Manager environment with logic and log function.
After it has gone into production, I can now share it with you guys🤓
WHAT IS WIM?
Windows Imaging (WIM) format is a file-based disk image format. It was developed by Microsoft to help deploy Windows Vista and subsequent versions of the Windows operating systems.
With the Deployment Image Servicing and Management (DISM) tool, it is possible to create a data image for applications, files, and other resources.
Okay, let's get started! As mentioned above, you need the Deployment Image Servicing and Management (DISM) tool in order to capture an application as WIM format and you must use this tool from either CMD or PowerShell.
Note: There is currently an ongoing discussion for and against using MAX compression when using deduplication in your environment. I've tested both FAST and MAX compression and I have not experienced any problems in our environment and we are using deduplication along with BranchCache.
But I tend to listen to clever people, so my recommendation at this point is to use "/Compress:fast" if you are using deduplication, just to be safe🤓
7-ZIP: Wait a second, why WIM and not 7-Zip you might ask? Well, with WIM you only need to mount and unmount the image, which leaves a much smaller footprint than 7-Zip because you don't have to extract the content and use extra storage space!
Hashing: Microsoft Endpoint Configuration Manager uses a hashing function to determine if the files are different. Every file are given a hash value, which means that there may be hundreds of files per application to hash check during distributing and downloading content.
By using WIM captured applications, only two files need to be hash checked.
Now, let´s try and WIM the latest Java 8 Update 271 application.
Step 1. Create a temp folder containing your source application e.g. C:\Temp\Java
Step 2. From an elevated CMD or PowerShell prompt, run the below DISM command.
Creating WIM with the Deployment Image Servicing and Management (DISM) Tool
This will create an application.wim file and if we compare the source folder to the application.wim, we can see that it didn't reduce the size due to the already small size of the Java application.
Comparison of the Source Folder and WIM Application
But what happens if we make the same comparison with an Autodesk application?
Creating WIM with the Deployment Image Servicing and Management (DISM) Tool
Comparison of the Source Folder and WIM Application
Let´s compare the Autodesk Revit 2021 source folder with the WIM file. Whoa..! We went from 12.039 files and 1610 folders to 1 single WIM file and reduced the size by 2,5 GB! Damn! That's awesome 😎
This was the easy part! We can now focus on my PowerShell script, which will be used to deploy the application as WIM format.
The Deployment Script
Download the deployment script from my GitHub repo.
The script supports the following deployment modes (Install,Uninstall, Repair) and you only need to change a few lines for each of these deployment modes to fit your needs - See more in the script details.
Installing Java 8 Update 271
Uninstalling Java 8 Update 271
Repairing Java 8 Update 271
The script does also support Get-Help and Verbose.
Get-Help -Examples
Get-Help -Detailed
-Verbose
Script (Invoke-AppDeploy.ps1)
Create the Application
Okay, so let´s say that we want to deploy Microsoft Office Professional Plus 2019 in your environment and we have already created the application.wim file and modified the PowerShell script to fit your needs.
We will then have to created an application in Microsoft Endpoint Configuration Manager with an deployment type like we have done many times before, the only difference this time is the command lines used to install the application and that the source folder only contains the application.wim file, PowerShell script and maybe a folder with icons for Software Center (optional)
Source Folder with Application.wim and the PowerShell script
PowerShell Commands Used for Installation, Uninstall and Repair
Finish up the application creation, deploy it to your environment and enjoy😎
What Does the Log Say?
Earlier in this blog post I showed you how to WIM the Java 8 Update 271 application, let's get back to that deployment and see what the log says.
So, the script comes with a user-friendly and ingenious log function (If I must say so myself🤓). By default the script will create the log file in "C:\WINDOWS\Temp" and the log file will automatically split itself when it reaches 250 KB in size, the old log file will get time stamped and compressed.
As you can see in the below print screens, the Java 8 Update 271 is installed and uninstalled from different PS sessions (Hint - look at the different threads), the log is pretty detailed, but still user-friendly and it handles return codes as well, as you can see below.
Firstly, I must say that WIM your applications is pretty awesome! In most cases it can improve deployment time and reduce the size of the application and storage usage on the content share and distribution point.
In our BranchCache enabled production environment we have seen 30 - 60% improvements on deployment time for huge applications like Autodesk Revit and it has also reduced the application creation wait time in the Microsoft Endpoint Configuration Manager console.
But as you can also read from this blog post, you won't gain anything with small or already compressed applications, so the only thing you will gain here is to standardize your deployment methods.
With that said, I would definitely recommend "WIMMING" your applications, why? Because 1 file is better than 12,000 files and that is "WINNING" in the end😎
WIMMING is WINNING...
If you have any questions regarding this topic, feel free to reach out to me. I am most active on Twitter!