-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDebloat.ps1
218 lines (192 loc) · 7.57 KB
/
Debloat.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
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
Add-Type -AssemblyName PresentationFramework
# ASCII Art
$asciiArt = @"
____ _ _ _
| __ ) ___ ___| |_ | | (_)_ __
| _ \ / _ \/ __| __| | | | | '__|
| |_) | __/\__ \ |_ | |___| | |
|____/ \___||___/\__| |_____|_|_|
Welcome to the De-bloat Script
"@
# Display ASCII Art in PowerShell console
Write-Host $asciiArt -ForegroundColor Green
# Define De-bloat options (includes new apps list)
$appsList = @(
"Microsoft.3DBuilder",
"Microsoft.BingNews",
"Microsoft.GetHelp",
"Microsoft.Getstarted",
"Microsoft.MicrosoftOfficeHub",
"Microsoft.MicrosoftSolitaireCollection",
"Microsoft.MicrosoftStickyNotes",
"Microsoft.MSPaint",
"Microsoft.People",
"Microsoft.SkypeApp",
"Microsoft.Wallet",
"Microsoft.Windows.Photos",
"Microsoft.WindowsAlarms",
"Microsoft.WindowsCamera",
"Microsoft.WindowsMaps",
"Microsoft.WindowsSoundRecorder",
"Microsoft.Xbox.TCUI",
"Microsoft.XboxApp",
"Microsoft.XboxGameOverlay",
"Microsoft.XboxGamingOverlay",
"Microsoft.XboxSpeechToTextOverlay",
"Microsoft.ZuneMusic",
"Microsoft.ZuneVideo",
"Microsoft.Edge",
"3D Viewer",
"Adobe Express",
"Clipchamp",
"Facebook",
"Hidden City: Hidden Object Adventure",
"Instagram",
"Netflix",
"News",
"Prime Video",
"Solitaire Collection",
"Mixed Reality Portal",
"Roblox",
"TikTok",
"Age of Empires: Castle Siege",
"Asphalt 8: Airborne",
"Bubble Witch 3 Saga",
"Candy Crush Friends Saga",
"Candy Crush Saga",
"FarmVille 2: Country Escape",
"Fitbit Coach",
"Gardenscapes",
"Phototastic Collage",
"PicsArt Photo Studio",
"Print 3D",
"Spotify",
"Twitter"
)
# Create GUI using XAML
[xml]$xaml = @"
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Title="Windows De-Bloat Script" Height="600" Width="500">
<Grid>
<StackPanel Margin="10">
<TextBlock Text="Select Apps to Remove:" FontWeight="Bold" FontSize="16"/>
<ScrollViewer Height="300">
<StackPanel Name="appCheckBoxPanel" Margin="5"/>
</ScrollViewer>
<Button Name="btnSelectAll" Content="Select All" Width="100" Margin="10" HorizontalAlignment="Left"/>
<CheckBox Name="chkDisableServices" Content="Disable Unnecessary Services" IsChecked="True" Margin="5"/>
<CheckBox Name="chkDisableTelemetry" Content="Disable Telemetry" IsChecked="True" Margin="5"/>
<CheckBox Name="chkDisableCortana" Content="Disable Cortana" IsChecked="True" Margin="5"/>
<Button Name="btnRun" Content="Run" Width="80" Margin="10" HorizontalAlignment="Center"/>
<TextBlock Name="txtStatus" Text="Status: Idle" Margin="10" HorizontalAlignment="Center"/>
<TextBlock Text="Additional Options:" FontWeight="Bold" FontSize="16"/>
<CheckBox Name="chkInstallIntelDrivers" Content="Install Intel Drivers" Margin="5"/>
<CheckBox Name="chkInstallAMDDdrivers" Content="Install AMD Drivers" Margin="5"/>
<CheckBox Name="chkInstallChromium" Content="Install Chromium" Margin="5"/>
<TextBlock Text="For more tools visit: " FontWeight="Bold"/>
<TextBlock>
<Hyperlink NavigateUri="http://flubhub.top">flubhub.top</Hyperlink>
</TextBlock>
</StackPanel>
</Grid>
</Window>
"@
# Load XAML and create window
$reader = New-Object System.Xml.XmlNodeReader $xaml
$window = [Windows.Markup.XamlReader]::Load($reader)
# Get form elements
$appCheckBoxPanel = $window.FindName("appCheckBoxPanel")
$btnRun = $window.FindName("btnRun")
$btnSelectAll = $window.FindName("btnSelectAll")
$chkDisableServices = $window.FindName("chkDisableServices")
$chkDisableTelemetry = $window.FindName("chkDisableTelemetry")
$chkDisableCortana = $window.FindName("chkDisableCortana")
$txtStatus = $window.FindName("txtStatus")
$chkInstallIntelDrivers = $window.FindName("chkInstallIntelDrivers")
$chkInstallAMDDdrivers = $window.FindName("chkInstallAMDDdrivers")
$chkInstallChromium = $window.FindName("chkInstallChromium")
# Handle hyperlink navigation
$window.FindName("Hyperlink").RequestNavigate += {
param($sender, $e)
[System.Diagnostics.Process]::Start($e.Uri.AbsoluteUri)
$e.Handled = $true
}
# Dynamically create checkboxes for each app
$appCheckboxes = @{}
foreach ($app in $appsList) {
$checkBox = New-Object Windows.Controls.CheckBox
$checkBox.Content = $app
$checkBox.IsChecked = $false
$appCheckBoxPanel.Children.Add($checkBox)
$appCheckboxes[$app] = $checkBox
}
# Define event for button click
$btnRun.Add_Click({
$txtStatus.Text = "Status: Running..."
$removedApps = @()
# Remove selected apps
foreach ($app in $appCheckboxes.Keys) {
if ($appCheckboxes[$app].IsChecked -eq $true) {
$txtStatus.Text = "Status: Removing $app..."
try {
Get-AppxPackage -Name $app | Remove-AppxPackage -ErrorAction Stop
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -EQ $app | Remove-AppxProvisionedPackage -Online -ErrorAction Stop
$removedApps += $app
} catch {
$txtStatus.Text = "Status: $app could not be removed. Already removed or not found."
}
}
}
# Remove successfully deleted apps from the list
foreach ($app in $removedApps) {
$appCheckboxes[$app].IsChecked = $false
$appCheckBoxPanel.Children.Remove($appCheckboxes[$app])
$appCheckboxes.Remove($app)
}
if ($chkDisableServices.IsChecked -eq $true) {
# Disable unnecessary services
$txtStatus.Text = "Status: Disabling unnecessary services..."
$services = @('DiagTrack', 'dmwappushservice', 'SysMain', 'RemoteRegistry', 'RetailDemo', 'XboxNetApiSvc')
foreach ($service in $services) {
Set-Service -Name $service -StartupType Disabled -ErrorAction SilentlyContinue
Stop-Service -Name $service -ErrorAction SilentlyContinue
}
}
if ($chkDisableTelemetry.IsChecked -eq $true) {
# Disable telemetry
$txtStatus.Text = "Status: Disabling telemetry..."
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" -Name AllowTelemetry -Value 0
}
if ($chkDisableCortana.IsChecked -eq $true) {
# Disable Cortana
$txtStatus.Text = "Status: Disabling Cortana..."
Stop-Process -Name Cortana -Force
Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search" -Name AllowCortana -Value 0
}
if ($chkInstallIntelDrivers.IsChecked -eq $true) {
# Install Intel drivers
$txtStatus.Text = "Status: Installing Intel drivers..."
Start-Process "https://downloadcenter.intel.com/download/29945" -Wait
}
if ($chkInstallAMDDdrivers.IsChecked -eq $true) {
# Install AMD drivers
$txtStatus.Text = "Status: Installing AMD drivers..."
Start-Process "https://www.amd.com/en/support" -Wait
}
if ($chkInstallChromium.IsChecked -eq $true) {
# Install Chromium
$txtStatus.Text = "Status: Installing Chromium..."
Start-Process "https://www.google.com/chrome/?platform=win64" -Wait
}
$txtStatus.Text = "Status: Completed"
})
# Event for
# Event for Select All button
$btnSelectAll.Add_Click({
foreach ($checkBox in $appCheckBoxPanel.Children) {
if ($checkBox -is [Windows.Controls.CheckBox]) {
$checkBox.IsChecked = $true
}
}
})
# Show the window
$window.ShowDialog() | Out-Null