Bankesy Posted August 28, 2024 Posted August 28, 2024 Good afternoon, Does anybody have an effective working script for removing AppX provisioned packages that I could use please? I've tried a couple of different things from other sources but not having much luck. Thanks
jthompson Posted August 28, 2024 Posted August 28, 2024 This is how we do it. We first mount a vanilla Windows image from a deployment share (MDT here still)... Mount-WindowsImage -ImagePath "E:\DeploymentShare01\Operating Systems\Windows 11 Education 23H2\sources\install.wim" -Index 1 -Path "E:\Mounted" ...then run the following script to remove any unwanted Appx packages... # Create a list of unwanted AppX package names. $Apps = @( "*DevHome*" "*FeedbackHub*" "*GamingApp*" "*GetHelp*" "*Getstarted*" "*Microsoft3DViewer*" "*MicrosoftOfficeHub*" "*MixedReality*" "*News*" "*OneNote*" "*Outlook*" "*People*" "*PowerAutomateDesktop*" "*Skype*" "*Solitaire*" "*Todos*" "*Weather*" "*WindowsMaps*" "*Xbox*" "*YourPhone*" ) # Remove packages for all users. ForEach($App in $Apps){ Get-AppxProvisionedPackage -Path "E:\Mounted" | where {$_.PackageName -like $App} | Remove-AppxProvisionedPackage } ...and then finally save the changes back to the Windows image in the deployment share. Dismount-WindowsImage -Path "E:\Mounted" -Save If you're wanting to do this on the running Windows system rather than on a reference image, I suppose you'd just adjust the Get-AppxProvisionedPackage command in the script. Note that pre-existing users will likely still have the Appx apps, since they'll have already been provisioned into their user profiles. 2
sraper Posted September 23, 2024 Posted September 23, 2024 I am using this <# Based on code from https://www.burgerhout.org/remove-bloatware-on-windows-10/ #> #List of 'apps' to remove $UninstallPackages = @( 'Microsoft.BingNews' 'Microsoft.BingWeather' 'Microsoft.GamingApp' 'Microsoft.GetHelp' 'Microsoft.Getstarted' 'Microsoft.MicrosoftSolitaireCollection' 'Microsoft.MixedReality.Portal' 'Microsoft.People' 'Microsoft.PowerAutomateDesktop' 'Microsoft.Skype' 'Microsoft.Windows.DevHome' 'microsoft.windowscommunicationsapps' 'Microsoft.WindowsFeedbackHub' 'Microsoft.Xbox.TCUI' 'Microsoft.XboxGameOverlay' 'Microsoft.XboxGamingOverlay' 'Microsoft.XboxIdentityProvider' 'Microsoft.XboxSpeechToTextOverlay' 'Microsoft.YourPhone' 'Microsoft.ZuneMusic' 'Microsoft.ZuneVideo' ) # List of programs to uninstall $UninstallPrograms = @( ) # Create a tag file just so Intune knows this was installed if (-not (Test-Path "$($env:ProgramData)\Microsoft\RemoveWindowsBloatware")) { Mkdir "$($env:ProgramData)\Microsoft\RemoveWindowsBloatware" } Set-Content -Path "$($env:ProgramData)\Microsoft\RemoveWindowsBloatware\RemoveWindowsBloatware-1-0.ps1.tag" -Value "Installed" # Start logging Start-Transcript "$($env:ProgramData)\Microsoft\RemoveWindowsBloatware\RemoveWindowsBloatware-1-0.log" # get all provisioned packages $AppList = Get-AppXProvisionedPackage -Online | Where {($removeList -contains $_.PackageName)} #and other apps $InstalledAppList = Get-AppxPackage -AllUsers | Where {($removeList -contains $_.PackageFullName)} $InstalledPrograms = Get-Package | Where {$UninstallPrograms -contains $_.Name} $InstalledPackages = Get-AppxPackage -AllUsers | Where {($UninstallPackages -contains $_.Name)} $ProvisionedPackages = Get-AppxProvisionedPackage -Online | Where {($UninstallPackages -contains $_.DisplayName)} $InstalledPrograms = Get-Package | Where {$UninstallPrograms -contains $_.Name} # Remove provisioned packages first ForEach ($ProvPackage in $ProvisionedPackages) { Write-Host -Object "Attempting to remove provisioned package: [$($ProvPackage.DisplayName)]..." Try { $Null = Remove-AppxProvisionedPackage -PackageName $ProvPackage.PackageName -Online -ErrorAction Stop Write-Host -Object "Successfully removed provisioned package: [$($ProvPackage.DisplayName)]" } Catch {Write-Warning -Message "Failed to remove provisioned package: [$($ProvPackage.DisplayName)]"} } # Remove appx packages ForEach ($AppxPackage in $InstalledPackages) { Write-Host -Object "Attempting to remove Appx package: [$($AppxPackage.Name)]..." Try { $Null = Remove-AppxPackage -Package $AppxPackage.PackageFullName -AllUsers -ErrorAction Stop Write-Host -Object "Successfully removed Appx package: [$($AppxPackage.Name)]" } Catch {Write-Warning -Message "Failed to remove Appx package: [$($AppxPackage.Name)]"} } # Remove installed programs $InstalledPrograms | ForEach { Write-Host -Object "Attempting to uninstall: [$($_.Name)]..." Try { $Null = $_ | Uninstall-Package -AllVersions -Force -ErrorAction Stop Write-Host -Object "Successfully uninstalled: [$($_.Name)]" } Catch {Write-Warning -Message "Failed to uninstall: [$($_.Name)]"} } Stop-Transcript
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now