Tuesday, 08 May 2018 19:52

Removing Windows 10 Apps / Capabilities Offline

Written by
Rate this item
(1 Vote)

image

In several of my previous articles, I've discussed how to remove built-in applications and capabilities during operating system deployment. Over the past few years, I delivered quite a few customer-focused Windows 10 workshops in which I placed emphasis on covering Windows as a Service in great depth. After all, one of my primary goals is to enable IT departments to keep pace with more frequent Windows updates and to allow them to continuously deliver new functionality to end-users. I realize that there are still some misconceptions out there as well as a need for more user guidance. In today's blog post I'd like to focus on removing built-in applications and capabilities straight from install.wim, and why you might want to do this in the first place.

Windows 10 "April 2018 Update", also known as version 1803, "Redstone 4", or RS4, is now available via Windows Update for Business, Windows Server Update Services (WSUS), the Volume Licensing Servicing Center (VLSC), and Visual Studio Subscriptions. Each Windows 10 release introduces new applications and Windows 10, version 1803, is no different. As faithful readers of my blog will know - yes, all three of them - starting with Windows 10 1703, applications removed during OS deployment will not come back after applying a feature update. However, new applications and/or capabilities will still be installed/activated as part of the feature update installation process. This is the default behavior and I do not expect it to change.

There are multiple ways of dealing with unwanted applications during the feature update scenario. You could remove applications after the fact, using a script based solution. I do not recommend this approach as you may encounter various timing issues with the installation of provisioned apps. Alternatively - assuming you are using volume licensing media - you could leverage Deployment Image Servicing and Management to remove packages from an offline Windows 10, version 1803 image. From a servicing perspective, this is the simplest approach for applying feature updates - mount the WIM file as a part of the Windows file system and make changes to the mounted Windows image in the WIM file - making it easier than ever to deploy new releases in a timely fashion.

The Tools You Need

Contrary to some rumors, you must install the latest version of the Windows Assessment and Deployment Kit (Windows ADK), which contains all of the tools that are required. Unfortunately, there has been some confusion around this in blogs and in the Windows technical community. This does not mean that using an older version of the Windows ADK will not work, but this scenario is not being supported by Microsoft and you may end up facing unexpected issues.

The Basic Approach

Here is a high-level overview of the app removal process:

  • Mount your Windows 10 image. To mount a volume licensing media WIM file, you must specify an image index. Starting with Windows 10, version 1709 single Windows image (WIM) file contains all the volume licensing images: Windows 10 Pro (volume licensing version), Windows 10 Enterprise, and Windows 10 Education.
    Note: use the optimize option to reduce initial mount time. Keep in mind that when using the optimize option, processes that are ordinarily performed during a WIM mount will instead be completed the first time that you access a directory.
    Important consideration: You should mount a WIM to an empty directory - just to eliminate confusion from any files you have stored there.
  • After you mount an image, you can enumerate provisioned Appx packages and then remove either all of them or a subset of the built-in applications and/or capabilities.
  • Finally, unmount and commit your changes. This makes your modifications a permanent part of the image. It's vital to understand that while you're making changes to the mounted WIM file, you are working with a cache of the WIM file, you are not changing the actual WIM file directly. There was a time where I would often forget to commit my changes (and thus losing them).

Making It Dynamic

It's worth emphasizing that with Microsoft introducing Windows as a Service your base image is constantly changing — the reality is that new features are now being built continuously, and feature updates that add new functionality are released two times per year. We as IT Pros have to become more agile as we have to adopt more frequent Windows releases. Thus, capturing and modifying the Windows image for feature updates needs to be as fast and easy as possible. The faster release cadences with regular feature updates mean that you need to streamline and automate your deployment processes in order to be more agile and keep pace - a PowerShell script is an obvious choice here to allow you to quickly modify the Windows 10 image in order to remove a constrained number of apps.

As per usual, I am not a fan of reinventing the wheel - there is literally no reason to waste time and develop a solution that might already be available on TechNet or an IT pro's blog. However, while a quick Google search yielded numerous results, none of the scripts did what I wanted them to do: mount a Windows 10 install.wim, remove a constrained set of provisioned apps and capabilities and commit the changes to the WIM file, so I quickly put together a script while heavily borrowing from the Michael Niehaus' excellent RemoveApps script. You can get the end result from my GitHub repository.

Before you run the script, you may need to adjust a few variables: $MountFolder, $MountPath, and $WimPath. By default, the script will remove all apps and capabilities, but I am providing sample RemoveApps.xml and RemoveCapabilities.xml files with a choice selection of in-box applications and capabilities. Note: If those files don't exist, the script will create these two files in the script folder, so you can run the script once (just make sure you either do not commit your changes or replace your install.wim after running the script). Then you can modify the files - the next time you run the script it will remove only the apps and capabilities you specified.

Moving forward, I am looking at options to optimize this process even further, for example by adding quality update offline servicing into the mix.

Read 4515 times Last modified on Wednesday, 09 May 2018 08:16
  1. Comments (15)

  2. Add yours

Comments (15)

This comment was minimized by the moderator on the site

Looked at quite a few of these removeapps scripts and yours looks pretty good. I'd just like to clarify a few points:-

So I run this script off-line in the 'Postinstall' stage of the task sequence?

$MountFolder = {Folder that WIM is mounted...

Looked at quite a few of these removeapps scripts and yours looks pretty good. I'd just like to clarify a few points:-

So I run this script off-line in the 'Postinstall' stage of the task sequence?

$MountFolder = {Folder that WIM is mounted to?}
$MountPath = "{Path that WIM is mounted to?}"
$WimPath = "{source of WIM, is this the WIM that is already imported into the deploy share?}"

Do I need to tweak the script if I put the script and xml files in a folder under %SCRIPTROOT% ? (I like to keep added scripts separate from the MDT default scripts.)

Thank,

Paul

Read More
This comment was minimized by the moderator on the site

Thank you. It is a direct result of various customer engagements combined with Microsoft's best practices. This script is OSD solution agnostic since you run it against install.wim beforeyou import OS sources into MDT/ConfigMgr/... Primarily you...

Thank you. It is a direct result of various customer engagements combined with Microsoft's best practices. This script is OSD solution agnostic since you run it against install.wim beforeyou import OS sources into MDT/ConfigMgr/... Primarily you would want to do this in a feature update scenario. If you are looking for a script solution to remove built-in apps/capabilities during OSD / ref image creation, I would recommend using my remove capabilities script in conjunction with Michael Niehaus' remove in-box apps script.

Read More
This comment was minimized by the moderator on the site

Great explications and the script is working just like a charm. What I'm wondering about: How do you remove the new apps from(for example) 1803 when the Computer is updated and not redeployt with a fresh image ? We are using a small PS-Script...

Great explications and the script is working just like a charm. What I'm wondering about: How do you remove the new apps from(for example) 1803 when the Computer is updated and not redeployt with a fresh image ? We are using a small PS-Script which runs via GPO during Login to do so.... But your script is great to remov them from the image(which we haven't done before). So thx anyway

Read More
This comment was minimized by the moderator on the site

@PS: if you are using Windows Update (for Business), then a logon script is the way to go. However, if you are using a TS based approach as some of my customers do, then you can remove the in-box apps straight from the WIM. This is fully...

@PS: if you are using Windows Update (for Business), then a logon script is the way to go. However, if you are using a TS based approach as some of my customers do, then you can remove the in-box apps straight from the WIM. This is fully supported by Microsoft, by the way and eliminates the necessity for a logon script (which may be problematic anyway due to various timing issues you may run into)

Read More
This comment was minimized by the moderator on the site

Yep, using Windows Update via WSUS. What you mean by "TS based approach". Terminalserver Solution ? Thx again, grat content in your blog, won't be the last time you've heared from me.

This comment was minimized by the moderator on the site

Appreciated! TS = task sequence based. Basically, any OS deployment solution such as MDT, ConfigMgr, LanDesk, etc allows you to import the setup media and run the feature update via command line bypassing typical Windows servicing via WUfB...

This comment was minimized by the moderator on the site

Hi Anton,

Thanks for answering my earlier questions.

So I've setup the following:-
E:\Temp - to hold install.wim that I've copied from the 1803 ISO
E:\Mount - empty folder

I've set the following in the script:-
$MountFolder = "Mount"
$Mou...

Hi Anton,

Thanks for answering my earlier questions.

So I've setup the following:-
E:\Temp - to hold install.wim that I've copied from the 1803 ISO
E:\Mount - empty folder

I've set the following in the script:-
$MountFolder = "Mount"
$MountPath = "E:\"
$MountFull = $MountPath + $MountFolder
$WimPath = "E:\temp\install.wim"
$WimIndex = "5" #NOTE: pre-1709: 1 = Enterprise, 1709: 3 = Enterprise, 5 = Pro

I get the following result:-
MDT-WIMServicing.ps1 - Mounting WIM


Path : E:\Mount
Online : False
Restart Needed : False

MDT-WIMServicing.ps1 - Removing apps
Apps selected for removal: 22
Removing provisioned package Microsoft.BingWeather
Remove-AppxProvisionedPackage : The directory is not empty.
At E:\Temp\Scripts\MDT-WIMServicing.ps1:140 char:14
+ $a = Remove-AppxProvisionedPackage -Path $MountFull -PackageName $curren ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( [Remove-AppxProvisionedPackage], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.RemoveAppxProvisionedPackageCommand

{same output for all 22 listed apps}

I'm obviously doing something dumb :-(

Read More
This comment was minimized by the moderator on the site

Hi Paul,

I tried reproducing your issue by running the script on a different system against the latest Insider build, no luck:

PS C:\WINDOWS\system32> Get-AppList | Remove-App
Apps selected for removal:  38
Removing provisioned package...

Hi Paul,

I tried reproducing your issue by running the script on a different system against the latest Insider build, no luck:

PS C:\WINDOWS\system32> Get-AppList | Remove-App
Apps selected for removal:  38
Removing provisioned package Microsoft.BingWeather
Removing provisioned package Microsoft.DesktopAppInstaller
Removing provisioned package Microsoft.GetHelp
Removing provisioned package Microsoft.Getstarted
Removing provisioned package Microsoft.HEIFImageExtension
Removing provisioned package Microsoft.Messaging
Removing provisioned package Microsoft.Microsoft3DViewer
Removing provisioned package Microsoft.MicrosoftOfficeHub
Removing provisioned package Microsoft.MicrosoftSolitaireCollection
Removing provisioned package Microsoft.MicrosoftStickyNotes


Since this is a DISM related error, I would start by verifying that the Mount folder is empty before you expand your image. Some anti-virus vendors are also known to interfere with DISM.

Obviously, I tested the script on Windows 10 platforms only (starting with Windows 10, version 1607 and various iterations of Windows ADK). Which OS are you trying to run the script on?

Read More
This comment was minimized by the moderator on the site

Hello Anton,

I am upgrading via SCCM TS from 1607 to 1803. I have removed the apps with your script from my installation source. I made sure that I used the correct index for my windows version.

Users with an old existing profile and users...

Hello Anton,

I am upgrading via SCCM TS from 1607 to 1803. I have removed the apps with your script from my installation source. I made sure that I used the correct index for my windows version.

Users with an old existing profile and users which profile is generated fresh are still seeing the apps (or links) in the startmenü... is there something I have forgotten? When I try to start for example Maps the first time, I see a small status bar under the Icon.

Thanks in advance!

Tobias

Read More
This comment was minimized by the moderator on the site

Are you seeing links in the start menu or on the start screen? The latter is quite possible and can be fixed by deploying a customized start screen layout.

This comment was minimized by the moderator on the site

Hello Anton,

I see the links in the alphabetical sorted list where all programs are found, not int the tile wall.

This comment was minimized by the moderator on the site

I'll try to reproduce your issue next week when I am on-site.

This comment was minimized by the moderator on the site

I can't reproduce your issue. Did you remove provisioned appx packages from your 1607 installations?

There are no comments posted here yet
Load More

Leave your comments

  1. Posting comment as a guest.
0 Characters
Attachments (0 / 3)
Share Your Location

Recent Posts