This website uses cookies to ensure you get the best experience on our website. Learn more
Remove unwanted APPX applications
Have you ever wanted to deploy a Windows 10 client, but without all the built-in Windows Store applications that it comes with? This is possible with running a simple script in MDT.
The following script removes unwanted applications after the operating system installation. Use the $WhiteListedApps variable to set the apps you want to keep, and the $WhiteListOnDemand variable to set the Features on Demand you want to keep. You can copy and save it as a Powershell script file (.ps1).
# Functions function Write - LogEntry { param([parameter(Mandatory = $true, HelpMessage = "Value added to the RemovedApps.log file.")][ValidateNotNullOrEmpty()][string] $Value, [parameter(Mandatory = $false, HelpMessage = "Name of the log file that the entry will written to.")][ValidateNotNullOrEmpty()][string] $FileName = "RemovedApps.log") # Determine log file location $LogFilePath = Join - Path - Path $env: windir - ChildPath "Temp\$($FileName)" # Add value to log file try { Add - Content - Value $Value - LiteralPath $LogFilePath - ErrorAction Stop } catch [System.Exception] { Write - Warning - Message "Unable to append log entry to RemovedApps.log file" } } # Get a list of all apps Write - LogEntry - Value "Starting built-in AppxPackage and AppxProvisioningPackage removal process" $AppArrayList = Get - AppxPackage - PackageTypeFilter Bundle - AllUsers | Select - Object - Property Name, PackageFullName | Sort - Object - Property Name # White list of appx packages to keep installed $WhiteListedApps = @(# "Microsoft.BingWeather", # "Microsoft.BioEnrollment", "Microsoft.DesktopAppInstaller", # "Microsoft.GetHelp", # "Microsoft.Getstarted", # "Microsoft.Messaging", # "Microsoft.Microsoft3DViewer", # "Microsoft.MicrosoftOfficeHub", # "Microsoft.MicrosoftSolitaireCollection", # "Microsoft.MicrosoftStickyNotes", # "Microsoft.MixedReality.Portal", "Microsoft.MSPaint", # "Microsoft.Office.OneNote", # "Microsoft.OneConnect", # "Microsoft.People", #aktivera sen # "Microsoft.Print3D", "Microsoft.ScreenSketch", # "Microsoft.SkypeApp", "Microsoft.StorePurchaseApp", # "Microsoft.Wallet", "Microsoft.Windows.Photos", # "Microsoft.WindowsAlarms", # "Microsoft.WindowsCamera", # "Microsoft.Windows.CapturePicker", # "Microsoft.Windows.Cortana", # "Microsoft.Windowscommunicationsapps", # Mail, calender osv.# "Microsoft.WindowsFeedbackHub", # "Microsoft.WindowsMaps", "Microsoft.WindowsSoundRecorder", "Microsoft.WindowsStore", # "Microsoft.Xbox.TCUI", # "Microsoft.XboxApp", # "Microsoft.XboxGameOverlay", # "Microsoft.XboxGamingOverlay", # "Microsoft.XboxIdentityProvider", # "Microsoft.XboxSpeechToTextOverlay", # "Microsoft.YourPhone", # "Microsoft.ZuneMusic", # "Microsoft.ZuneVideo" "Microsoft.WindowsCalculator") # Loop through the list of appx packages foreach($App in $AppArrayList) { # If application name not in appx package white list, remove AppxPackage and AppxProvisioningPackage if (($App.Name - in $WhiteListedApps)) { Write - LogEntry - Value "Skipping excluded application package: $($App.Name)" } else { # Gather package names $AppPackageFullName = Get - AppxPackage - Name $App.Name | Select - Object - ExpandProperty PackageFullName $AppProvisioningPackageName = Get - AppxProvisionedPackage - Online | Where - Object { $_.DisplayName - like $App.Name } | Select - Object - ExpandProperty PackageName # Attempt to remove AppxPackage if ($AppPackageFullName - ne $null) { try { Write - LogEntry - Value "Removing application package: $($App.Name)" Remove - AppxPackage - Package $AppPackageFullName - ErrorAction Stop | Out - Null } catch [System.Exception] { Write - LogEntry - Value "Removing AppxPackage failed: $($_.Exception.Message)" } } else { Write - LogEntry - Value "Unable to locate AppxPackage for app: $($App.Name)" } # Attempt to remove AppxProvisioningPackage if ($AppProvisioningPackageName - ne $null) { try { Write - LogEntry - Value "Removing application provisioning package: $($AppProvisioningPackageName)" Remove - AppxProvisionedPackage - PackageName $AppProvisioningPackageName - Online - ErrorAction Stop | Out - Null } catch [System.Exception] { Write - LogEntry - Value "Removing AppxProvisioningPackage failed: $($_.Exception.Message)" } } else { Write - LogEntry - Value "Unable to locate AppxProvisioningPackage for app: $($App.Name)" } } } # White list of Features On Demand V2 packages Write - LogEntry - Value "Starting Features on Demand V2 removal process" $WhiteListOnDemand = "NetFX3|Tools.Graphics.DirectX|Tools.DeveloperMode.Core|Language|Browser.InternetExplorer|WindowsMediaPlayer|App.Support.QuickAssist" # Get Features On Demand that should be removed $OnDemandFeatures = Get - WindowsCapability - Online | Where - Object { $_.Name - notmatch $WhiteListOnDemand - and $_.State - like "Installed" } | Select - Object - ExpandProperty Name foreach($Feature in $OnDemandFeatures) { try { Write - LogEntry - Value "Removing Feature on Demand V2 package: $($Feature)" Get - WindowsCapability - Online - ErrorAction Stop | Where - Object { $_.Name - like $Feature } | Remove - WindowsCapability - Online - ErrorAction Stop | Out - Null } catch [System.Exception] { Write - LogEntry - Value "Removing Feature on Demand V2 package failed: $($_.Exception.Message)" } } # Complete Write - LogEntry - Value "Completed built-in AppxPackage and AppxProvisioningPackage removal process"
Add the script to a share and follow the steps below to add it to your task sequence in MDT. Alternatively, if you are a Specops Deploy user, you can add it to the scripts folder in your deployment repository.
- Open the Deployment Workbench.
- Connect to your Deployment Share.
- Select Task Sequences.
- Select the Windows 10 image that you would like to remove the APPX applications from.
- Right click on the image and select Properties.
- Select the Task Sequence tab.
- Select State Restore.
- Click Add – General – Run Powershell Script.
- Name the script Cleanup appx applications.
- Enter the path where your script is located.
- Click OK.
If you are using Specops Deploy/OS remember to publish your Deployment Repository.
After you deploy your Windows 10 client with the script in your MDT task sequences, you will have a nice clean start menu without all of the Microsoft default applications. To further customize your start menu, read Customize the Windows 10 start menu.
(Last updated on October 30, 2023)