Ho scaricato il pacchetto per disinstallare le applicazioni Microsoft preinstallate.
Ma nella console appare un messaggio che indica "impossibile rimuovere Microsoft.yourphone" (ad esempio), e questo accade per quasi tutte le app che si tenta di disinstallare
Sebbene l'app sia correttamente installata sul computer, il pacchetto non esegue la disinstallazione.
Ecco il pacchetto; l'ho modificato per mantenere solo alcune app
Codice: Seleziona tutto
r"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()
"""
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
apps = [
### Windows 10 default apps
#"Microsoft.3DBuilder",
#"Microsoft.Print3D",
#"Microsoft.Microsoft3DViewer",
#'Microsoft.Appconnector',
#'Microsoft.MSPaint',
#'Microsoft.Windows.Photos',
#'Microsoft.WindowsCalculator',
#"Microsoft.WindowsCamera",
#"Microsoft.WindowsMaps",
#"Microsoft.WindowsSoundRecorder",
#"Microsoft.WindowsStore",
"Microsoft.MixedReality.Portal",
"Microsoft.YourPhone",
"Microsoft.WindowsFeedbackHub",
"Microsoft.Windows.Cortana",
"Microsoft.GetHelp",
"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.WindowsAlarms",
"Microsoft.WindowsPhone",
"Microsoft.XboxApp",
"Microsoft.XboxGameOverlay",
"Microsoft.XboxGameCallableUI",
"Microsoft.XboxGamingOverlay",
"Microsoft.XboxIdentityProvider",
"Microsoft.XboxSpeechToTextOverlay",
"Microsoft.Xbox.TCUI",
"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.*",
"ClearChannelRadioDigital.iHeartRadio",
"4DF9E0F8.Netflix",
"6Wunderkinder.Wunderlist",
"Drawboard.DrawboardPDF",
"2FE3CB00.PicsArt-PhotoStudio",
"D52A8D61.FarmVille2CountryEscape",
"TuneIn.TuneInRadio",
"TheNewYorkTimes.NYTCrossword",
"828B5831.HiddenCityMysteryofShadow",
"Microsoft.Advertising.Xaml",
"SpotifyAB.SpotifyMusic",
### Apps which cannot be removed using Remove-AppxPackage
'Microsoft.BioEnrollment',
"Microsoft.MicrosoftEdge",
"Microsoft.MicrosoftEdge.Stable",
"Microsoft.MicrosoftEdgeDevToolsClient",
"Microsoft.Windows.Cortana",
"Microsoft.WindowsFeedback",
"Windows.ContactSupport",
"Microsoft.Windows.CallingShellApp",
]
def install():
print("Removing: Unwanted Windows Store applications...")
for app in apps:
try:
print("If needed, removing: %s" % app)
remove_appx(app)
except:
print("Unable to remove: %s" % app)
def session_setup():
print("Removing: Unwanted Windows Store applications...")
for app in apps:
try:
print("If needed, removing: %s" % app)
remove_user_appx(app)
except:
print("Unable to remove: %s" % app)
def remove_appx(package, default_user=True):
r"""Uninstall and remove Windows AppX package from the computer in machine environnement
Args:
package (str): Package name, asterisk character (*) can be used as joker
default_user (bool): Remove from image that will be installed for each new users
.. versionadded:: 2.2
"""
if running_as_admin() or running_as_system():
run_powershell('Get-AppxPackage "%s" -AllUsers | Remove-AppxPackage -AllUsers' % package)
if default_user:
run_powershell(
'Get-AppXProvisionedPackage -Online | Where-Object DisplayName -Like "%s" | Remove-AppxProvisionedPackage -Online -AllUsers' % package
)
else:
run_powershell('Get-AppxPackage "%s" | Remove-AppxPackage' % package)
def remove_user_appx(package):
r"""Uninstall and remove Windows AppX package from the computer in user environnement
Args:
package (str): AppX Package name, asterisk character (*) can be used as wildcard
.. versionadded:: 2.3
"""
run_powershell('Get-AppxPackage "%s" | Remove-AppxPackage' % package)