-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUninstaller.ps1
More file actions
99 lines (84 loc) · 4.21 KB
/
Uninstaller.ps1
File metadata and controls
99 lines (84 loc) · 4.21 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
<#
.DESCRIPTION
This is a script that can uninstall windows default applications on your system. I use the winget method or Get-AppxPackage command
.SYNOPSIS
Use to uninstall windows default applications.
#>
# Source: https://gist.github.com/ThioJoe/5cc29231c5cb1a8f051df28a69073f77
function uninstaller() {
if (Get-Command -Name winget) {
do {
Clear-Host
Write-Host "Listing all application installed on the system..." -ForegroundColor Yellow
winget list
Write-Host
Write-Host "Type the Id! Type 'exit' or leave it empty to skip!" -ForegroundColor Green
Write-Host "Type '2' to search apps" -ForegroundColor Green
Write-Host "You can type more than one, just make sure to put a space after each one!" -ForegroundColor Green
Write-Host "Example : king.com.CandyCrushSaga_kgqvnymyfvs32 Joplin.Joplin 9NKSQGP7F2NH {024A6CF5-627D-497F-980B-B9A6EC5C40AF}_is1" -ForegroundColor Red
Write-Host
$WingetAppId = Read-Host -Prompt "Id "
if ((!$WingetAppId) -or ($WingetAppId -eq 'exit'.ToLower())) {
Write-Host "`nExit Uninstalling Application..." -ForegroundColor Yellow
break
}
elseif ($WingetAppId -eq "2") {
searchApps
break
}
else {
$ArrayID = $WingetAppId.Split(" ")
Clear-Host
foreach ($EachAppId in $ArrayID) {
Write-Host "Uninstalling Application..." -ForegroundColor Yellow
winget uninstall --id "${EachAppId}"
}
}
Write-Host "`nEnter to continue..." -NoNewline
Read-Host
} while ($true)
}
}
function searchApps() {
if (Get-Command -Name winget) {
do {
Clear-Host
Write-Host "Type 'exit' or leave it empty to skip!" -ForegroundColor Green
Write-Host "Type '1' to uninstall some apps" -ForegroundColor Green
Write-Host "Only type 1 application!`n" -ForegroundColor Green
$WingetAppName = Read-Host -Prompt "App Name "
if ((!$WingetAppName) -or ($WingetAppName -eq 'exit'.ToLower())) {
Write-Host "`nExit Searching Application..." -ForegroundColor Yellow
break
}
elseif ($WingetAppName -eq "1") {
uninstaller
break
}
else {
Clear-Host
Write-Host "Searching Application..." -ForegroundColor Yellow
winget list --name "${WingetAppName}"
Write-Host "`nEnter to continue..." -NoNewline
Read-Host
}
} while ($true)
}
}
# ===================================================================================================================================================
Write-Host " Uninstalling System Application " -ForegroundColor Blue
Write-Host " --------------------------------------------------------------------------------------------------------------- "
Write-Host "| No | Option | Why ? |"
Write-Host " --------------------------------------------------------------------------------------------------------------- "
Write-Host "| 1 | Uninstall Package | Because you want to uninstall windows default windows applications |"
Write-Host "| 2 | Search Application By Name | Because on winget sometimes the Id got cutoff (idk why) |"
Write-Host " --------------------------------------------------------------------------------------------------------------- "
Write-Host "Choose your option : " -ForegroundColor Blue -NoNewline
$Option = Read-Host
if ($Option -eq 1) {
uninstaller
}
elseif ($Option -eq 2) {
searchApps
}
# ===================================================================================================================================================