Repository navigation
Expand file tree
/
Copy pathremoveApps.ps1
More file actions
228 lines (217 loc) · 5.68 KB
/
Copy pathremoveApps.ps1
File metadata and controls
228 lines (217 loc) · 5.68 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<#
.SYNOPSIS
.
.DESCRIPTION
Remove some preinstalled Apps or check if they are installed.
.PARAMETER Mode
"remove" (default) or "check" or "list"
.PARAMETER Name
A custom app name to handle.
.PARAMETER Confirm
Skip confirmation and just remove without asking.
.EXAMPLE
PS C:> removeApps.ps1
Remove all apps in the list with confirmation
.EXAMPLE
PS C:> removeApps.ps1 -Confirm
Remove all apps in the list without confirmation
.EXAMPLE
PS C:> removeApps.ps1 check
Check all apps in the list
.EXAMPLE
PS C:> removeApps.ps1 check *XboxSpeechToTextOverlay*
Check app with name *XboxSpeechToTextOverlay*
.NOTES
Author: FKIE CAD
Date: 01.07.2025
#>
Param (
[Parameter(Mandatory=$false)]
[ValidateNotNull()]
[string]$Mode="remove",
[Parameter(Mandatory=$false)]
[ValidateNotNull()]
[string]$Name,
[Parameter(Mandatory=$false)]
[switch]$Confirm
)
Write-Host "Mode: $Mode"
Write-Host "Name: $Name"
Write-Host "Confirm: $Confirm"
#
## Remove an app.
## Checks the app for being a package or not and removes it depending on the outcome.
## Remove-AppxProvisionedPackage seems not to be needed but can be added if wanted.
##
## https://www.tenforums.com/software-apps/165584-completely-uninstall-provisioned-apps-how-detailed-explanation.html
##
## Get-AppxPackage
## https://learn.Microsoft.com/en-us/powershell/module/appx/get-appxpackage?view=windowsserver2025-ps
## Remove-AppxPackage
## https://learn.Microsoft.com/en-us/powershell/module/appx/remove-appxpackage?view=windowsserver2025-ps
## Remove-AppxProvisionedPackage
## https://learn.Microsoft.com/en-us/powershell/module/dism/remove-appxprovisionedpackage?view=windowsserver2025-ps
#
function remove-app(
[string]$Name
)
{
$p = Get-AppxPackage -AllUsers -Name $Name
if ( $p )
{
if ( $p.NonRemovable )
{
Write-Host "[i] NonRemovable"
return
}
if ( $p.IsBundle )
{
if ( $Confirm )
{
Get-AppxPackage -AllUsers -PackageTypeFilter Bundle -Name $Name | Remove-AppxPackage -AllUsers
}
else
{
Get-AppxPackage -AllUsers -PackageTypeFilter Bundle -Name $Name | Remove-AppxPackage -AllUsers -Confirm
}
}
else
{
if ( $Confirm )
{
# Get-AppxPackage -AllUsers -Name $Name | Remove-AppxPackage -AllUsers -Confirm | Remove-AppxProvisionedPackage -AllUsers -Online
Get-AppxPackage -AllUsers -Name $Name | Remove-AppxPackage -AllUsers
}
else
{
Get-AppxPackage -AllUsers -Name $Name | Remove-AppxPackage -AllUsers -Confirm
}
}
}
# else
# {
# Write-Host "Not found!"
# }
}
function check-app(
[string]$Name
)
{
$p = Get-AppxPackage -AllUsers -Name $Name
if ( $p )
{
if ( $p.IsBundle )
{
Get-AppxPackage -AllUsers -PackageTypeFilter Bundle -Name $Name
}
else
{
Get-AppxPackage -AllUsers -Name $Name
}
}
else
{
Write-Host "Not found!"
}
}
# $apps = New-Object System.Collections.ArrayList
# [void] $apps.AddRange(
# (
$apps = @(
"*Appconnector*",
"*bingfinance*",
"*IntelGraphicsExperience*",
"*MixedReality.Portal*",
"*Office.OneNote*",
"*OutlookForWindows*",
"*BingNews*",
"*BingSearch*",
"*bingsports*",
"*BingWeather*",
"*CandyCrushSaga*",
"*Clipchamp*",
"*Copilot*",
"*Edge.GameAssist*",
"*Messaging*",
"*People*",
"*GetHelp*",
"*WindowsSoundRecorder*",
"*MicrosoftStickyNotes*",
"*PowerAutomateDesktop*",
"*Microsoft.549981C3F5F10*", # Cortana
"*Microsoft.Getstarted*",
# "Microsoft.Microsoft3DViewer",
# "Microsoft.MSPaint",
"*Microsoft.StartExperiencesApp*", # powers Windows Widgets My Feed so you can stay informed, entertained, and inspired!
"*Microsoft.Wallet*", # Shopping convenience meets data security with Wallet – one place to store your payment methods, passwords, and more.
"*Microsoft.WidgetsPlatformRuntime*", # enables the functionality of widgets
"*Microsoft.Widgets*",
"*WebExperience*", # widgets feeder
"*Microsoft.XboxGameCallableUI*",
"*Microsoft.XboxSpeechToTextOverlay*",
"*Microsoft.Xbox.TCUI*",
"*Microsoft.XboxIdentityProvider*",
"*Microsoft.XboxGamingOverlay*",
"*Microsoft.Xbox*",
"*Microsoft.Xbox.*",
"*MicrosoftFamily*",
"*WindowsCamera*",
"*windowscommunicationsapps*", # People, Mail, and Calendar
"*WindowsFeedbackHub*",
"*Todos*",
"*WindowsAlarms*",
"*Teams*",
"*YourPhone*",
"*SpotifyAB.SpotifyMusic*",
"*SolitaireCollection*",
"*OneDriveSync*",
"*soundrecorder*",
"*SkypeApp*",
"*GamingApp*",
"*officehub*",
"*Windows.DevHome*",
"*WindowsMaps*",
"*windowsphone*",
"*WindowsScan*",
# "*windowscalculator*",
"*ZuneMusic*",
"*ZuneVideo*"
)
# )
if ( $Mode -eq "r" -or $Mode -eq "remove" )
{
if ( $Name )
{
Write-Host "removing:" $Name
remove-app $Name
}
else
{
for ( $i = 0; $i -lt $apps.Count; $i++ )
{
Write-Host "removing:" $apps[$i]
remove-app $apps[$i]
}
}
}
elseif ( $Mode -eq "c" -or $Mode -eq "check" )
{
if ( $Name )
{
Write-Host "checking:" $Name
check-app $Name
}
else
{
for ( $i = 0; $i -lt $apps.Count; $i++ )
{
Write-Host "checking:" $apps[$i]
check-app $apps[$i]
}
}
}
else
{
Write-Error "Unknown mode!"
}
exit $LASTEXITCODE