-
Notifications
You must be signed in to change notification settings - Fork 2
/
Clean_Win10Apps.ps1
108 lines (95 loc) · 3.26 KB
/
Clean_Win10Apps.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
Set-StrictMode -Version 2.0
<#
# Updated for 1903
# - Added holographic first run, may have caused weird start menu bug without it
# - change to 3d viewer application name
# - added game bar removal
#>
$sw = [System.Diagnostics.Stopwatch]::StartNew()
$InstalledApps = Get-AppxPackage -AllUsers | Select-Object Name
$AppList = @(
#Default Windows 10 apps
"Microsoft.3DBuilder"
"Microsoft.Appconnector"
"Microsoft.BingFinance"
"Microsoft.BingNews"
"Microsoft.BingSports"
"Microsoft.CommsPhone"
"Microsoft.ConnectivityStore"
"Microsoft.GetHelp"
"Microsoft.Getstarted"
"Microsoft.Windows.HolographicFirstRun"
"Microsoft.Messaging"
"Microsoft.MicrosoftOfficeHub"
"Microsoft.Microsoft3DViewer"
"Microsoft.MixedReality.Portal"
"Microsoft.NetworkSpeedTest"
"Microsoft.Office.OneNote"
"Microsoft.Office.Sway"
"Microsoft.OneConnect"
"Microsoft.People"
"Microsoft.Print3D"
"Microsoft.SkypeApp"
"Microsoft.Wallet"
"Microsoft.WindowsAlarms"
"Microsoft.WindowsCamera"
"microsoft.windowscommunicationsapps"
"Microsoft.WindowsFeedbackHub"
"Microsoft.WindowsMaps"
"Microsoft.WindowsPhone"
"Microsoft.WindowsSoundRecorder"
"Microsoft.WindowsStore"
"Microsoft.YourPhone"
"Microsoft.ZuneMusic"
"Microsoft.ZuneVideo"
#Candy Crush
"*CandyCrush*"
#Minecraft
"Microsoft.MinecraftUWP"
#XBox
"Microsoft.XboxApp"
"Microsoft.XboxGameOverlay"
"Microsoft.XboxGamingOverlay"
"Microsoft.XboxIdentityProvider"
"Microsoft.XboxSpeechToTextOverlay"
"Microsoft.Xbox.TCUI"
#Non-Microsoft
"*Twitter*"
"Flipboard.Flipboard"
"ShazamEntertainmentLtd.Shazam"
"ClearChannelRadioDigital.iHeartRadio"
"*Pandora*"
"*Duolingo*"
#Apps to keep
#"Microsoft.BingWeather"
#"Microsoft.DesktopAppInstaller"
#"Microsoft.MicrosoftSolitaireCollection"
#"Microsoft.ScreenSketch"
#"Microsoft.StorePurchaseApp"
)
foreach($appfound in $InstalledApps){
Write-Host "$($appfound.Name) was found in Installed Apps" -ForegroundColor Yellow
foreach($possibleapp in $AppList){
if ($appfound.Name -like $possibleapp){
Write-Host "`t$($appfound.Name) matched $possibleapp" -ForegroundColor green
$appholder = Get-AppxPackage -Name $possibleapp -AllUsers
try{
Remove-AppxPackage $appholder -ErrorAction SilentlyContinue
Write-Host "`t$appholder was removed" -ForegroundColor DarkGreen
}catch{
Write-Host "`t$appholder couldn't be removed" -ForegroundColor Red
}
$appholder2 = Get-AppXProvisionedPackage -Online | Where-Object DisplayName -EQ $possibleapp
if($null -ne $appholder2){
try{
Remove-AppxProvisionedPackage $appholder2 -Online
Write-Host "`t$($appholder2.DisplayName) was removed" -ForegroundColor DarkGreen
}catch{
Write-Host "`tUnable to remove the online app $($appholder2.DisplayName)" -ForegroundColor DarkMagenta
}
}
}
}
}
$sw.Stop()
Write-Host "Script has finished in $($sw.Elapsed.ToString())"