# -*- coding: utf-8 -*-
from setuphelpers import *
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.MixedReality.Portal",
"Microsoft.YourPhone",
"Microsoft.WindowsFeedbackHub",
"Microsoft.Windows.Cortana",
"Microsoft.GetHelp",
#'Microsoft.Appconnector',
"Microsoft.BingFinance",
"Microsoft.BingNews",
"Microsoft.BingSports",
"Microsoft.BingWeather",
"Microsoft.FreshPaint",
#'Microsoft.MSPaint',
"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.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...")
uninstall_list = get_uninstall_list(apps, all_users=True)
# Trying to remove host appxpackages
for app in uninstall_list:
try:
print("Trying to remove: %s" % app)
remove_appx(app)
print("Removed: %s" % app)
except:
print("Unable to remove: %s" % app)
def session_setup():
print("Removing: Unwanted Windows Store applications...")
uninstall_list = get_uninstall_list(apps, all_users=False)
# Trying to remove user appxpackages
for app in uninstall_list:
try:
print("Trying to remove: %s" % app)
remove_appx(app)
print("Removed: %s" % app)
except:
print("Unable to remove: %s" % app)
def get_uninstall_list(apps, all_users=False):
uninstall_list = []
if all_users == True:
installed_appx_packages = run_powershell("Get-AppxPackage -AllUsers")
else:
installed_appx_packages = run_powershell("Get-AppxPackage")
for packages in installed_appx_packages:
if packages["Name"] in apps:
uninstall_list.append(packages["Name"])
return uninstall_list