The PowerShell Script
Here is a PowerShell script to automate the removal of specified Appx packages:
powershellCopier le code# List of Applications to Remove
$AppPackages = @()
$AppPackages += 'Microsoft.3DBuilder'
$AppPackages += 'Microsoft.BingWeather'
$AppPackages += 'Microsoft.DesktopAppInstaller'
$AppPackages += 'Microsoft.Getstarted'
$AppPackages += 'Microsoft.Messaging'
$AppPackages += 'Microsoft.MicrosoftOfficeHub'
$AppPackages += 'Microsoft.MicrosoftSolitaireCollection'
$AppPackages += 'Microsoft.MicrosoftStickyNotes'
$AppPackages += 'Microsoft.Office.OneNote'
$AppPackages += 'Microsoft.Office.OneConnect'
$AppPackages += 'Microsoft.People'
$AppPackages += 'Microsoft.SkypeApp'
$AppPackages += 'Microsoft.StorePurchaseApp'
$AppPackages += 'Microsoft.Windows.Photos'
$AppPackages += 'Microsoft.WindowsAlarms'
$AppPackages += 'Microsoft.WindowsCalculator'
$AppPackages += 'Microsoft.WindowsCamera'
$AppPackages += 'microsoft.windowscommunicationsapps'
$AppPackages += 'Microsoft.WindowsFeedbackHub'
$AppPackages += 'Microsoft.WindowsMaps'
$AppPackages += 'Microsoft.WindowsPhone'
$AppPackages += 'Microsoft.WindowsSoundRecorder'
$AppPackages += 'Microsoft.WindowsStore'
$AppPackages += 'Microsoft.XboxApp'
$AppPackages += 'Microsoft.XboxIdentityProvider'
$AppPackages += 'Microsoft.ZuneMusic'
$AppPackages += 'Microsoft.ZuneVideo'
foreach ($App in $AppPackages) {
Write-Host "Removing Package: $App"
$Package = Get-AppxPackage | Where-Object {$_.Name -eq $App}
if ($Package -ne $null) {
Remove-AppxPackage -Package $Package.PackageFullName -ErrorAction SilentlyContinue
}
$Package = Get-AppxPackage -AllUsers | Where-Object {$_.Name -eq $App}
if ($Package -ne $null) {
Remove-AppxPackage -Package $Package.PackageFullName -ErrorAction SilentlyContinue
}
$ProvisionedPackage = Get-AppxProvisionedPackage -Online | Where-Object {$_.DisplayName -eq $App}
if ($ProvisionedPackage -ne $null) {
Remove-AppxProvisionedPackage -Online -PackageName $ProvisionedPackage.PackageName -ErrorAction SilentlyContinue
}
}
Using the Script
- Download and prepare the script:
- Copy the above PowerShell script into a file named
RemoveAppxPackages.ps1
.
- Copy the above PowerShell script into a file named
- Run the script:
- Open PowerShell with administrative rights.
- Navigate to the directory where the script is saved.
- Execute the script:powershellCopier le code
.\RemoveAppxPackages.ps1
- Verification:
- After running the script, check your system to ensure that the specified Appx packages have been removed.
0 Comments