@echo off
cls

echo Suppression des APPX
rem désactive l'UAC
REG ADD HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 0 /f

rem désactivation de la mise à jour automatique des APPX via le Windows Store et du MCE
REG ADD HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\WindowsStore /v AutoDownload /t REG_DWORD /d 2 /f
REG ADD HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\CloudContent /v DisableWindowsConsumerFeatures /t REG_DWORD /d 1 /f
net stop InstallService
sc config InstallService start=disabled

rem Suppression des APPX du compte courrant
Powershell -command "Get-AppxPackage|where-object {$_.NonRemovable -ne \"True\"}|Remove-AppxPackage"
timeout 5
cls

rem Suppression des APPX de tous les comptes locaux existants et d‚sapprovionnement des APPX de Windows.
Powershell -command "Get-AppxPackage -AllUsers|where-object {$_.NonRemovable -ne \"True\"}|Remove-AppxPackage"

rem si erreur 0x80073cf2 dans log sysprep (Utilisateur supprimé avant Remove-AppxPackage)
FOR /F "skip=3 tokens=*" %%a IN ('type %TMP%\allUsersPackages.txt') do (
Powershell -command "Get-AppxProvisionedPackage -Online|where-object {$_.NonRemovable -ne \"True\"}|Select PackageFullName>%TMP%\allUsersPackages.txt"
)

FOR /F "skip=3 tokens=*" %%a IN ('type %TMP%\allUsersPackages.txt') do (
Powershell -command "Remove-AppxPackage -AllUsers -Package %%a"
Powershell -command "Remove-AppxProvisionedPackage -Online -PackageName %%a"
)
del /Q %TMP%\allUsersPackages.txt

echo "AppXProvisionedPackage -Online" Powershell -command "Get-AppXProvisionedPackage -Online | Remove-AppxProvisionedPackage -online"
Dernière modification: le 2018/11/21