Hi @Fiona Yan-MSFT
Thanks for your quick reply.
This is the task sequence:
Options tab:
The powershell script (*.AppsToKeep.xml *=company)
# Script removes all Windows 10 apps you don't want to keep
# Version 1.0: First release
# Version 1.1: Changed remove AppxProvisionedPackage from blacklist to whitelist approach
# Version 1.2: Remove WindowsPackage "Contact Support"
# Version 2.0: Moved Array $appsToKeep from script to XML input
param(
[parameter(Position=0,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='xml filename like ***.AppsToKeep.xml')][string]$ConfigFile = ''
)
#If no xml defind use default
If (($ConfigFile -eq '') -or ($ConfigFile -eq $null)) {
$ConfigXML = "AppsToKeep.xml"
} Else {
$thisScript = $myInvocation.MyCommand.Path
$scriptRoot = Split-Path(Resolve-Path $thisScript)
$ConfigXML = Join-Path $scriptRoot $ConfigFile.Replace('.\','')
}
#Read Configuration File
$xml = [xml](get-content $configXML)
$AppsToKeep = $xml.AppsToKeep.AppName
If ($AppsToKeep -eq $null) {exit}
$AppsInstalled = Get-AppxProvisionedPackage -Online | % { $_.DisplayName }
$AppsToRemove = Compare-Object $AppsInstalled $AppsToKeep -PassThru
Foreach ($App in $AppsToRemove) {
Get-AppxProvisionedPackage -Online | ? { $_.DisplayName -eq $App } | Remove-AppxProvisionedPackage -Online
}
# Remove WindowsPackage by blacklist
Get-WindowsPackage -Online | ? { $_.PackageName -like "*ContactSupport*" } | Remove-WindowsPackage -Online -NoRestart
The AppsToKeep.xml:
<?xml version="1.0" encoding="utf-8"?>
<AppsToKeep>
<AppName>Microsoft.Windows.Photos</AppName>
<AppName>Microsoft.WindowsCalculator</AppName>
<AppName>Microsoft.WindowsStore</AppName>
<AppName>Microsoft.MSPaint</AppName>
<AppName>Microsoft.Office.OneNote</AppName>
<AppName>Microsoft.WindowsCamera</AppName>
<AppName>Microsoft.MicrosoftStickyNote</AppName>
</AppsToKeep>
I wil check the non-official article, thanks!