14 December 2020

DISM to remove Win10 Appx apps from a .WIM file

Here's a great way to remove packages from a WIM file to ensure you don't have to build and capture another image within SCCM.  

This has come about due to a client having an image, and later requiring certain apps to be removed.

Create a new folder on your server called "Mounted_Image"

Mount your WIM file to that location with the following command:

Mount-WindowsImage -ImagePath "E:\SourceFiles\CapturedWims\CAPTURE001.wim" -Index 1 -Path "c:\Mounted_image"

Now create a PS1 file with the following, which will allow you to remove the various appx packages:

$apps=@( 	
	"9E2F88E3.Twitter"
	"ClearChannelRadioDigital.iHeartRadio"
	"Flipboard.Flipboard"
	"king.com.CandyCrushSodaSaga"
	"Microsoft.3DBuilder"
	"Microsoft.BingFinance"
	"Microsoft.BingNews"
	"Microsoft.BingSports"
	"Microsoft.BingWeather"
	"Microsoft.CommsPhone"
	"Microsoft.Getstarted"
	"Microsoft.Messaging"
	"Microsoft.MicrosoftOfficeHub"
    "Microsoft.MicrosoftSolitaireCollection"
	"Microsoft.Office.OneNote"
	"Microsoft.Office.Sway"
	"Microsoft.People"
	"Microsoft.SkypeApp"
	"Microsoft.Windows.Phone"
	"Microsoft.WindowsMaps"
	"Microsoft.WindowsPhone"
	"Microsoft.WindowsSoundRecorder"
	"Microsoft.XboxApp"
	"Microsoft.ZuneMusic"
	"Microsoft.ZuneVideo"
	"microsoft.windowscommunicationsapps"
	"Microsoft.MinecraftUWP"
	"ShazamEntertainmentLtd.Shazam"	
    "Microsoft.Xbox.TCUI"
    "Microsoft.XboxGameOverlay"
    "Microsoft.XboxGamingOverlay"
    "Microsoft.XboxIdentityProvider"
    "Microsoft.XboxSpeechToTextOverlay"
    "Microsoft.StorePurchaseApp"
    "Microsoft.Wallet"
    "Microsoft.WindowsAlarms"
    "Microsoft.WindowsFeedbackHub"
    	
)

foreach ($app in $apps) {	
	Get-AppXProvisionedPackage -path C:\Mounted_Image | where DisplayName -EQ $app | Remove-AppxProvisionedPackage
    }

That'll then go through and remove the various packages from the WIM file.

You can test after this by running the following command:

Get-AppxProvisionedPackage -Path c:\Mounted_Image

Once you are done, make sure you save the WIM file and dismount with the following command:

Dismount-WindowsImage -Path c:\Mounted_Image -Save


3 comments:

  1. Before visiting to your page I was watching a drama show on <a href="https://www.vingle.net/posts/3909261>Watch VOOT in USA</a> and I can say that it is true value for money and i bookmarked your page for fututre use.

    ReplyDelete
  2. It was nice to read your blog. If anyone needs case study help then visit to our website:- My Case Study Help . We provide all type of case study assignments for MBA, Nursing, Laws and Engineering students.

    ReplyDelete