Passer au contenu principal

Désinstaller les applications en CLI

Avec Winget

Source : Windows 11 uninstall preinstalled apps.

for %i in (Clipchamp Cortana Actualités "MSN Météo" Xbox Office "Solitaire & Casual Games" "Pense-bêtes Microsoft" "Microsoft People" "Microsoft OneDrive" "Microsoft Teams" "Microsoft Family" "Mobile connecté" "Xbox Game Speech Window" "Xbox Identity Provider" "Xbox Game Bar" "Xbox Game Bar Plugin" "Xbox TCUI" "Hub de commentaires" "Microsoft To Do") do winget uninstall %i

Complètement désinstaller des applications

Pour obtenir la liste :

Get-AppxPackage | Select Name, PackageFullName >"$env:userprofile\Desktop\myapps.txt"
Get-AppxPackage -allusers | Select Name, PackageFullName >"$env:userprofile\Desktop\allapps.txt"

Créer le fichier CleanInstall.ps1 :

$keywords = @(
	'Clipchamp'
	'BingWeather'
	'GamingApp'
	'MicrosoftOfficeHub'
	'MicrosoftSolitaireCollection'
	'MicrosoftStickyNotes'
	'People'
	'Todos'
	'Xbox'
	'YourPhone'
	'ZuneMusic'
	'ZuneVideo'
	'Teams'
	'WindowsFeedbackHub'
	'MicrosoftEdge'
)

for ($i = 0 ; $i -lt $keywords.count ; $i++) {
	$keyword = $keywords[$i]
	echo $keyword
	Get-AppxProvisionedPackage -online | where-object {$_.packagename -like "*$keyword*"} | Remove-AppxProvisionedPackage -online
}

À noter que certains paquets ne sont pas désinstallables.

Puis le lancer depuis un terminal PowerShell administrateur.

En cas d'erreur d'exécution du script :

powershell.exe -ExecutionPolicy Unrestricted

̈Puis relancer le script.

Complet

Tout d'un coup :

$wingetsToDel = @(
	'Clipchamp'
	'Cortana'
	'Actualités'
	"MSN Météo"
	'Xbox'
	'Office'
	"Solitaire & Casual Games"
	"Pense-bêtes Microsoft"
	"Courrier et calendrier"
	"Photos Microsoft"
	"Cartes Windows"
	"Enregistreur vocal Windows"
	"Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe"
	"Microsoft People"
	"Microsoft OneDrive"
	"Microsoft Teams"
	"Microsoft Family"
	"Mobile connecté"
	"Xbox Game Speech Window"
	"Xbox Identity Provider"
	"Xbox Game Bar"
	"Xbox Game Bar Plugin"
	"Xbox TCUI"
	"Hub de commentaires"
	"Microsoft To Do"
) 

for ($i = 0 ; $i -lt $wingetsToDel.count ; $i++) {
	$wingetToDel = $wingetsToDel[$i]
	echo $wingetToDel
	winget uninstall $wingetToDel
}

$packagesToDel = @(
	'Clipchamp'
	'BingWeather'
	'GamingApp'
	'MicrosoftOfficeHub'
	'MicrosoftSolitaireCollection'
	'MicrosoftStickyNotes'
	'People'
	'Todos'
	'Xbox'
	'YourPhone'
	'ZuneMusic'
	'ZuneVideo'
	'Teams'
	'WindowsFeedbackHub'
	'MicrosoftEdge'
	'MicrosoftTeams'
	'Windows.Photos'
	'WindowsSoundRecorder'
	'PowerAutomateDesktop'
	'WindowsMaps'
	'windowscommunicationsapps'
)

for ($i = 0 ; $i -lt $packagesToDel.count ; $i++) {
	$packageToDel = $packagesToDel[$i]
	echo $packageToDel
	Get-AppxProvisionedPackage -online | where-object {$_.packagename -like "*$packageToDel*"} | Remove-AppxProvisionedPackage -online
}

Attention aux tirets lors du copier-coller…