Actualiser powershell/Remove-BuiltInApps.ps1

This commit is contained in:
2026-01-31 09:53:00 +01:00
parent a59d07279a
commit 54bba07fa3

View File

@@ -53,7 +53,7 @@ foreach ($App in $AppsToRemove) {
$ProvPkg = Get-AppxProvisionedPackage -Online | Where-Object DisplayName -eq $App.Package
if ($ProvPkg) {
$ProvPkg | Remove-AppxProvisionedPackage -Online -ErrorAction Stop
Write-Host ("Provisioned package removed: {0}" -f $App.Name) -ForegroundColor Green
Write-Host ("Provisioned package removed: {0}" -f $App.Name) -ForegroundColor Green
} else {
Write-Host ("No provisioned package found for {0}" -f $App.Name) -ForegroundColor Yellow
}
@@ -76,7 +76,7 @@ foreach ($UserProfile in $UserProfiles) {
$Pkg = Get-AppxPackage -User $Username -Name $App.Package
if ($Pkg) {
$Pkg | Remove-AppxPackage -User $Username -ErrorAction Stop
Write-Host ("Removed {0} from {1}" -f $App.Name, $Username) -ForegroundColor Green
Write-Host ("Removed {0} from {1}" -f $App.Name, $Username) -ForegroundColor Green
} else {
Write-Host ("{0} not installed for {1}" -f $App.Name, $Username) -ForegroundColor Yellow
}
@@ -93,7 +93,7 @@ foreach ($App in $AppsToRemove) {
$UserPkg = Get-AppxPackage -Name $App.Package
if ($UserPkg) {
$UserPkg | Remove-AppxPackage -ErrorAction Stop
Write-Host ("Removed {0} from current user" -f $App.Name) -ForegroundColor Green
Write-Host ("Removed {0} from current user" -f $App.Name) -ForegroundColor Green
} else {
Write-Host ("{0} is not installed for current user" -f $App.Name) -ForegroundColor Yellow
}