Removing Applications from Your Windows 11 Image – Before and During Deployment

A few weeks back I got a question on how to remove applications from a Windows 11 image. Now, obviously you can run a script on any existing Windows 11 installation to remove unwanted applications, and there are plenty of scripts out there doing that. For example, this script: Remove Built-in Windows 11 apps leveraging a Cloud-Sourced reference file – MSEndpointMgr

The above script is very useful when you have a fleet of existing devices, but if you are the person deploying Windows 11, it's way more effective removing them before deploying Windows 11. I mean, installing apps, just to remove them 10 minutes later is really no point. It's better to simply not install them at all.

There are two elegant ways of doing this:

  1. Remove the apps in the WIM image. This the static method.
  2. Remove the apps during the WinPE phase of your deployment. This is the dynamic method, since you can remove different depending on deployment criteria such as department, location etc.

Option #1 – Remove the apps in the WIM Image

If you are always removing the same applications from Windows 11, you might was well remove them directly from the WIM Image. In this guide I'm using the OSDBuilder PowerShell module from David Segura.

1. Download a Windows 11 23H2 ISO from Microsoft

2. Install and Import OSDBuilder by running the following PowerShell commands:

# Install and Import OSDBuilder Modules
Install-Module -Name OSD -Force
Install-Module -Name OSDBuilder -Force
Import-Module -Name OSDBuilder 

3. Import the Windows 11 media to OSDBuilder by running the following PowerShell commands:

# Specify Windows 11 23H2 ISO path, and edition to work with
$ISO = "C:\ISO\Windows 11 Business Editions x64 23H2 (updated April 2024).iso"
$Edition = "Windows 11 Enterprise"

# Mount the Operating System ISO
Mount-DiskImage -ImagePath $ISO

# Import the media
Import-OSMedia -ImageName $Edition -SkipGrid 

4. Specify which Windows 11 applications you want to remove and initiate a build by running the following PowerShell commands:

# Specify AppxPackages to Remove
$TaskName = "Remove Apps From Windows 11 23H2"
New-OSBuildTask -TaskName $TaskName -RemoveAppx

# Create a new OS Build 
# Note: Purposely skipping updates for OS and WinPE since the imported media was already updated
New-OSBuild -ByTaskName $TaskName -Execute -SkipComponentCleanup -SkipUpdates
Selecting which applications you want to remove.
Building the OS.

5. You're done, and you find the new build in the OSDBuilder\OSBuilds folder.

The install.wim after application removal.

Option #2 – Remove the apps during the WinPE phase of your deployment.

If you need to remove different applications depending on how and where you deploy Windows 11 it's better to have a script removing the applications during deployment. There are plenty of script examples on the Internet for doing so online, but not offline, so here is a script you can use:

Simply add this script to a Run PowerShell Script action in your task sequence. Make sure to run it in the WinPE phase, for example before driver injection, and set the PowerShell execution policy to Bypass.

About the author

Johan Arwidmark

0 0 votes
Article Rating
Notify of
Oldest Most Voted
Inline Feedbacks
View all comments
17 days ago


Thank you for your posts. I'm currently receiving the following error when running the "Import-OSMedia -ImageName $Edition -SkipGrid

Any help is much Appreciated.

27 days ago

Thanks Johan,

For the great blog post as usual, for option 2 i believe you forget to add the script at the end of the post.