Before you run the script it is good to understand what is AppxPackage and
AppxProvisioned Package
AppX packages – Applications installed with the operating system
AppX provisioned packages – Applications installed for each new user to a
windows image.
The two commands which are used in the scripts are
1) Remove-AppxProvisionedPackage
2) Remove-AppxPackage
The Remove-AppxProvisionedPackage cmdlet removes app
packages (.appx) from a Windows image. App packages will not be installed when
new user accounts are created. Packages will not be removed from existing user
accounts. To remove app packages (.appx) that are not provisioned or to remove
a package for a particular user only, use Remove-AppxPackage instead.
https://docs.microsoft.com/en-us/powershell/module/dism/remove-appxprovisionedpackage?view=win10-ps
In MDT, When we create a windows image, we make the changes
in Audit Mode, which is the administrator account but when new user login for
the first time after the deployment the user profile get copied from the Default
Profile (Hidden by default).
Remove-Appx-ProvisionedPackage removes the packages from Default Profile so the
new users will not see those packages when they log in.
Each windows version comes with a different list of Application. It's better to
run the below commands and get the list.
Get-AppxProvisionedPackage -online | select DisplayName
Get-AppxPackage | select Name
Once you get the list and decide what you want to remove, you can add it to
the $AppList and the script will remove the Apps from the image.
Create a powershell script by copying the below and run it on the MDT image
$AppsList = "Microsoft.BingWeather",
"Microsoft.Getstarted",
"Microsoft.GetHelp",
"Microsoft.Messaging",
"Microsoft.Microsoft3DViewer",
"Microsoft.MicrosoftOfficeHub",
"Microsoft.MicrosoftSolitaireCollection",
"Microsoft.MixedReality.Portal",
"Microsoft.People",
"Microsoft.Office.OneNote",
"Microsoft.ScreenSketch",
"Microsoft.Wallet",
"Microsoft.windowscommunicationsapps",
"Microsoft.WindowsAlarms",
"Microsoft.SkypeApp",
"Microsoft.ZuneVideo",
"Microsoft.ZuneMusic",
"Microsoft.YourPhone",
"Microsoft.XboxSpeechToTextOverlay",
"Microsoft.XboxGamingOverlay",
"Microsoft.XboxGameOverlay",
"Microsoft.XboxIdentityProvider",
"Microsoft.XboxApp",
"Microsoft.Xbox.TCUI",
"Microsoft.WindowsMaps"
ForEach ($App in $AppsList)
{
$Packages = Get-AppxPackage | Where-Object {$_.Name -eq $App}
if ($Packages -ne $null)
{
"Removing Appx Package: $App"
foreach ($Package in $Packages) { Remove-AppxPackage -package
$Package.PackageFullName }
}
else { "Unable to find package: $App" }
$ProvisionedPackage = Get-AppxProvisionedPackage -online | Where-Object
{$_.displayName -eq $App}
if ($ProvisionedPackage -ne $null)
{
"Removing Appx Provisioned Package: $App"
remove-AppxProvisionedPackage -online -packagename
$ProvisionedPackage.PackageName
}
else { "Unable to find provisioned package: $App" }
}