Code : Tout sélectionner
# -*- coding: utf-8 -*-
from setuphelpers import *
import subprocess
import json
uninstallkey = []
apps = [
## default Windows 10 apps
'Microsoft.3DBuilder',
'Microsoft.Print3D',
'Microsoft.Microsoft3DViewer',
'Microsoft.MixedReality.Portal',
'Microsoft.YourPhone',
'Microsoft.WindowsFeedbackHub',
#'Microsoft.Appconnector',
'Microsoft.BingFinance',
'Microsoft.BingNews',
'Microsoft.BingSports',
'Microsoft.BingWeather',
#'Microsoft.FreshPaint',
'Microsoft.Getstarted',
'Microsoft.MicrosoftOfficeHub',
'Microsoft.MicrosoftSolitaireCollection',
#'Microsoft.MicrosoftStickyNotes',
#'Microsoft.Office.OneNote',
'Microsoft.OneConnect',
'Microsoft.People',
'Microsoft.SkypeApp',
#'Microsoft.Windows.Photos',
'Microsoft.WindowsAlarms',
#'Microsoft.WindowsCalculator',
#'Microsoft.WindowsCamera',
'Microsoft.WindowsMaps',
'Microsoft.WindowsPhone',
'Microsoft.WindowsSoundRecorder',
#'Microsoft.WindowsStore',
'Microsoft.XboxApp',
'Microsoft.ZuneMusic',
'Microsoft.ZuneVideo',
'microsoft.windowscommunicationsapps',
'Microsoft.MinecraftUWP',
'Microsoft.MixedReality.Portal'
#'Microsoft.ScreenSketch'
## Threshold 2 apps
'Microsoft.CommsPhone',
#'Microsoft.ConnectivityStore',
'Microsoft.Messaging',
#'Microsoft.Office.Sway',
##Redstone apps
'Microsoft.BingFoodAndDrink',
'Microsoft.BingTravel',
'Microsoft.BingHealthAndFitness',
'Microsoft.WindowsReadingList',
## non-Microsoft
'9E2F88E3.Twitter',
'Flipboard.Flipboard',
'ShazamEntertainmentLtd.Shazam',
'king.com.CandyCrushSaga',
'king.com.CandyCrushSodaSaga',
'king.com.*',
'ClearChannelRadioDigital.iHeartRadio',
'4DF9E0F8.Netflix',
'6Wunderkinder.Wunderlist',
'Drawboard.DrawboardPDF',
'2FE3CB00.PicsArt-PhotoStudio',
'D52A8D61.FarmVille2CountryEscape',
'TuneIn.TuneInRadio',
'TheNewYorkTimes.NYTCrossword',
'king.com.CandyCrushSag',
'king.com.CandyCrushSodaSaga',
'828B5831.HiddenCityMysteryofShadow',
'Microsoft.Advertising.Xaml',
## apps which cannot be removed using Remove-AppxPackage
#'Microsoft.BioEnrollment',
#'Microsoft.MicrosoftEdge',
'Microsoft.Windows.Cortana',
#'Microsoft.WindowsFeedback',
'Microsoft.XboxGameCallableUI',
'Microsoft.XboxIdentityProvider',
'Windows.ContactSupport',
]
def install():
print(u'Starting the debloating process...')
removed = []
for app in apps:
print(u"Trying to remove %s"%app)
result = run_powershell("""\
Get-AppxPackage -Name %s -AllUsers | Remove-AppxPackage""" % app)
if result:
removed.append(app)
print run_powershell("""\
Get-AppXProvisionedPackage -Online |
where DisplayName -EQ %s |
Remove-AppxProvisionedPackage -Online""" % app)
old_removed = json.loads(WAPT.read_param(control.package,'[]'))
print(u'Previously removed by wapt :\n%s' % ('\n'.join(old_removed),))
## old_removed.extend(removed)
## WAPT.write_param(control.package,old_removed)
print(u'Remaining metro apps ;) : ')
## print u'\n'.join(sorted(u'"%(Name)s", # (%(Version)s)",' % app for app in run_powershell('Get-AppxPackage -AllUsers')))
def uninstall():
old_removed = json.loads(WAPT.read_param(control.package,'[]'))
print(u'Previously removed by wapt :\n%s' % ('\n'.join(old_removed),))
for app in old_removed:
result = run_powershell('Get-AppxPackage -Name %(app)s -AllUsers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}' % locals())
print result