Merge pull request #202 from bmho-tk/master

Code formatting clean up. Repaired GUI.
pull/210/head
Richard Newton 5 years ago committed by GitHub
commit 13119ef098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,9 +1,17 @@
<#
$EnableEdgePDFTakeover.Text = "Enable Edge PDF Takeover"
$EnableEdgePDFTakeover.Width = 185
$EnableEdgePDFTakeover.Height = 35
$EnableEdgePDFTakeover.Location = New-Object System.Drawing.Point(155, 260)
#>
#This will self elevate the script so with a UAC prompt since this script needs to be run as an Administrator in order to function properly. #This will self elevate the script so with a UAC prompt since this script needs to be run as an Administrator in order to function properly.
$ErrorActionPreference = 'silentlycontinue' $ErrorActionPreference = 'SilentlyContinue'
$Button = [Windows.MessageBoxButton]::YesNoCancel $Button = [System.Windows.MessageBoxButton]::YesNoCancel
$ErrorIco = [Windows.MessageBoxImage]::Error $ErrorIco = [System.Windows.MessageBoxImage]::Error
$Ask = 'Do you want to run this as an Administrator? $Ask = 'Do you want to run this as an Administrator?
Select "Yes" to Run as an Administrator Select "Yes" to Run as an Administrator
@ -13,12 +21,12 @@ $Ask = 'Do you want to run this as an Administrator?
Select "Cancel" to stop the script.' Select "Cancel" to stop the script.'
If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) { If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]'Administrator')) {
$Prompt = [Windows.MessageBox]::Show($Ask, "Run as an Administrator or not?", $Button, $ErrorIco) $Prompt = [System.Windows.MessageBox]::Show($Ask, "Run as an Administrator or not?", $Button, $ErrorIco)
Switch ($Prompt) { Switch ($Prompt) {
#This will debloat Windows 10 #This will debloat Windows 10
Yes { Yes {
Write-Host "You didn't run this script as an Administrator. This script will self elevate to run as an Administrator and continue." Write-Host "You didn't run this script as an Administrator. This script will self elevate to run as an Administrator and continue."
Start-Process powershell.exe -ArgumentList ("-NoProfile -ExecutionPolicy Bypass -File `"{0}`"" -f $PSCommandPath) -Verb RunAs Start-Process PowerShell.exe -ArgumentList ("-NoProfile -ExecutionPolicy Bypass -File `"{0}`"" -f $PSCommandPath) -Verb RunAs
Exit Exit
} }
No { No {
@ -117,10 +125,10 @@ $global:WhiteListedApps = @(
) )
#NonRemovable Apps that where getting attempted and the system would reject the uninstall, speeds up debloat and prevents 'initalizing' overlay when removing apps #NonRemovable Apps that where getting attempted and the system would reject the uninstall, speeds up debloat and prevents 'initalizing' overlay when removing apps
$NonRemovables = Get-AppxPackage -AllUsers | Where-Object { $_.NonRemovable -eq $true } | foreach { $_.Name } $NonRemovables = Get-AppxPackage -AllUsers | Where-Object { $_.NonRemovable -eq $true } | ForEach { $_.Name }
$NonRemovables += Get-AppxPackage | Where-Object { $_.NonRemovable -eq $true } | foreach { $_.Name } $NonRemovables += Get-AppxPackage | Where-Object { $_.NonRemovable -eq $true } | ForEach { $_.Name }
$NonRemovables += Get-AppxProvisionedPackage -Online | Where-Object { $_.NonRemovable -eq $true } | foreach { $_.DisplayName } $NonRemovables += Get-AppxProvisionedPackage -Online | Where-Object { $_.NonRemovable -eq $true } | ForEach { $_.DisplayName }
$NonRemovables = $NonRemovables | Sort-Object -unique $NonRemovables = $NonRemovables | Sort-Object -Unique
if ($NonRemovables -eq $null ) { if ($NonRemovables -eq $null ) {
# the .NonRemovable property doesn't exist until version 18xx. Use a hard-coded list instead. # the .NonRemovable property doesn't exist until version 18xx. Use a hard-coded list instead.
@ -199,146 +207,146 @@ Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles() [System.Windows.Forms.Application]::EnableVisualStyles()
#region begin GUI #region begin GUI
$Form = New-Object system.Windows.Forms.Form $Form = New-Object System.Windows.Forms.Form
$Form.ClientSize = '800,500' $Form.ClientSize = '800,500'
$Form.text = "Windows10Debloater" $Form.Text = "Windows10Debloater"
$Form.TopMost = $false $Form.TopMost = $false
$Debloat = New-Object system.Windows.Forms.Label $Debloat = New-Object System.Windows.Forms.Label
$Debloat.text = "Debloat Options" $Debloat.Text = "Debloat Options"
$Debloat.AutoSize = $true $Debloat.AutoSize = $true
$Debloat.width = 25 $Debloat.Width = 25
$Debloat.height = 10 $Debloat.Height = 10
$Debloat.location = New-Object System.Drawing.Point(9, 8) $Debloat.Location = New-Object System.Drawing.Point(9, 8)
$Debloat.Font = 'Microsoft Sans Serif,12,style=Bold,Underline' $Debloat.Font = 'Microsoft Sans Serif,12,style=Bold,Underline'
$CustomizeBlacklists = New-Object system.Windows.Forms.Button $CustomizeBlacklists = New-Object System.Windows.Forms.Button
$CustomizeBlacklists.text = "Customize Blacklist" $CustomizeBlacklists.Text = "Customize Blacklist"
$CustomizeBlacklists.width = 140 $CustomizeBlacklists.Width = 140
$CustomizeBlacklists.height = 40 $CustomizeBlacklists.Height = 40
$CustomizeBlacklists.location = New-Object System.Drawing.Point(9, 32) $CustomizeBlacklists.Location = New-Object System.Drawing.Point(9, 32)
$CustomizeBlacklists.Font = 'Microsoft Sans Serif,10' $CustomizeBlacklists.Font = 'Microsoft Sans Serif,10'
$RemoveAllBloatware = New-Object system.Windows.Forms.Button $RemoveAllBloatware = New-Object System.Windows.Forms.Button
$RemoveAllBloatware.text = "Remove All Bloatware" $RemoveAllBloatware.Text = "Remove All Bloatware"
$RemoveAllBloatware.width = 142 $RemoveAllBloatware.Width = 142
$RemoveAllBloatware.height = 40 $RemoveAllBloatware.Height = 40
$RemoveAllBloatware.location = New-Object System.Drawing.Point(8, 79) $RemoveAllBloatware.Location = New-Object System.Drawing.Point(8, 79)
$RemoveAllBloatware.Font = 'Microsoft Sans Serif,10' $RemoveAllBloatware.Font = 'Microsoft Sans Serif,10'
$RemoveBlacklist = New-Object system.Windows.Forms.Button $RemoveBlacklist = New-Object System.Windows.Forms.Button
$RemoveBlacklist.text = "Remove Bloatware With Customized Blacklist" $RemoveBlacklist.Text = "Remove Bloatware With Customized Blacklist"
$RemoveBlacklist.width = 205 $RemoveBlacklist.Width = 205
$RemoveBlacklist.height = 37 $RemoveBlacklist.Height = 37
$RemoveBlacklist.location = New-Object System.Drawing.Point(9, 124) $RemoveBlacklist.Location = New-Object System.Drawing.Point(9, 124)
$RemoveBlacklist.Font = 'Microsoft Sans Serif,10' $RemoveBlacklist.Font = 'Microsoft Sans Serif,10'
$Label1 = New-Object system.Windows.Forms.Label $Label1 = New-Object System.Windows.Forms.Label
$Label1.text = "Revert Registry Changes" $Label1.Text = "Revert Registry Changes"
$Label1.AutoSize = $true $Label1.AutoSize = $true
$Label1.width = 25 $Label1.Width = 25
$Label1.height = 10 $Label1.Height = 10
$Label1.location = New-Object System.Drawing.Point(254, 7) $Label1.Location = New-Object System.Drawing.Point(254, 7)
$Label1.Font = 'Microsoft Sans Serif,12,style=Bold,Underline' $Label1.Font = 'Microsoft Sans Serif,12,style=Bold,Underline'
$RevertChange = New-Object system.Windows.Forms.Button $RevertChange = New-Object System.Windows.Forms.Button
$RevertChange.text = "Revert Registry Changes" $RevertChange.Text = "Revert Registry Changes"
$RevertChange.width = 113 $RevertChange.Width = 113
$RevertChange.height = 36 $RevertChange.Height = 36
$RevertChange.location = New-Object System.Drawing.Point(254, 32) $RevertChange.Location = New-Object System.Drawing.Point(254, 32)
$RevertChange.Font = 'Microsoft Sans Serif,10' $RevertChange.Font = 'Microsoft Sans Serif,10'
$Label2 = New-Object system.Windows.Forms.Label $Label2 = New-Object System.Windows.Forms.Label
$Label2.text = "Optional Changes/Fixes" $Label2.Text = "Optional Changes/Fixes"
$Label2.AutoSize = $true $Label2.AutoSize = $true
$Label2.width = 25 $Label2.Width = 25
$Label2.height = 10 $Label2.Height = 10
$Label2.location = New-Object System.Drawing.Point(9, 193) $Label2.Location = New-Object System.Drawing.Point(9, 193)
$Label2.Font = 'Microsoft Sans Serif,12,style=Bold,Underline' $Label2.Font = 'Microsoft Sans Serif,12,style=Bold,Underline'
$DisableCortana = New-Object system.Windows.Forms.Button $DisableCortana = New-Object System.Windows.Forms.Button
$DisableCortana.text = "Disable Cortana" $DisableCortana.Text = "Disable Cortana"
$DisableCortana.width = 111 $DisableCortana.Width = 111
$DisableCortana.height = 36 $DisableCortana.Height = 36
$DisableCortana.location = New-Object System.Drawing.Point(9, 217) $DisableCortana.Location = New-Object System.Drawing.Point(9, 217)
$DisableCortana.Font = 'Microsoft Sans Serif,10' $DisableCortana.Font = 'Microsoft Sans Serif,10'
$EnableCortana = New-Object system.Windows.Forms.Button $EnableCortana = New-Object System.Windows.Forms.Button
$EnableCortana.text = "Enable Cortana" $EnableCortana.Text = "Enable Cortana"
$EnableCortana.width = 112 $EnableCortana.Width = 112
$EnableCortana.height = 36 $EnableCortana.Height = 36
$EnableCortana.location = New-Object System.Drawing.Point(9, 260) $EnableCortana.Location = New-Object System.Drawing.Point(9, 260)
$EnableCortana.Font = 'Microsoft Sans Serif,10' $EnableCortana.Font = 'Microsoft Sans Serif,10'
$StopEdgePDFTakeover = New-Object system.Windows.Forms.Button $StopEdgePDFTakeover = New-Object System.Windows.Forms.Button
$StopEdgePDFTakeover.text = "Stop Edge PDF Takeover" $StopEdgePDFTakeover.Text = "Stop Edge PDF Takeover"
$StopEdgePDFTakeover.width = 175 $StopEdgePDFTakeover.Width = 175
$StopEdgePDFTakeover.height = 35 $StopEdgePDFTakeover.Height = 35
$StopEdgePDFTakeover.location = New-Object System.Drawing.Point(155, 217) $StopEdgePDFTakeover.Location = New-Object System.Drawing.Point(155, 217)
$StopEdgePDFTakeover.Font = 'Microsoft Sans Serif,10' $StopEdgePDFTakeover.Font = 'Microsoft Sans Serif,10'
$EnableEdgePDFTakeover = New-Object system.Windows.Forms.Button $EnableEdgePDFTakeover = New-Object System.Windows.Forms.Button
$EnableEdgePDFTakeover.text = "Enable Edge PDF Takeover" $EnableEdgePDFTakeover.Text = "Enable Edge PDF Takeover"
$EnableEdgePDFTakeover.width = 185 $EnableEdgePDFTakeover.Width = 185
$EnableEdgePDFTakeover.height = 35 $EnableEdgePDFTakeover.Height = 35
$EnableEdgePDFTakeover.location = New-Object System.Drawing.Point(155, 260) $EnableEdgePDFTakeover.Location = New-Object System.Drawing.Point(155, 260)
$EnableEdgePDFTakeover.Font = 'Microsoft Sans Serif,10' $EnableEdgePDFTakeover.Font = 'Microsoft Sans Serif,10'
$DisableTelemetry = New-Object system.Windows.Forms.Button $DisableTelemetry = New-Object System.Windows.Forms.Button
$DisableTelemetry.text = "Disable Telemetry/Tasks" $DisableTelemetry.Text = "Disable Telemetry/Tasks"
$DisableTelemetry.width = 152 $DisableTelemetry.Width = 152
$DisableTelemetry.height = 35 $DisableTelemetry.Height = 35
$DisableTelemetry.location = New-Object System.Drawing.Point(365, 260) $DisableTelemetry.Location = New-Object System.Drawing.Point(365, 260)
$DisableTelemetry.Font = 'Microsoft Sans Serif,10' $DisableTelemetry.Font = 'Microsoft Sans Serif,10'
$RemoveRegkeys = New-Object system.Windows.Forms.Button $RemoveRegkeys = New-Object System.Windows.Forms.Button
$RemoveRegkeys.text = "Remove Bloatware Regkeys" $RemoveRegkeys.Text = "Remove Bloatware Regkeys"
$RemoveRegkeys.width = 188 $RemoveRegkeys.Width = 188
$RemoveRegkeys.height = 35 $RemoveRegkeys.Height = 35
$RemoveRegkeys.location = New-Object System.Drawing.Point(540, 260) $RemoveRegkeys.Location = New-Object System.Drawing.Point(540, 260)
$RemoveRegkeys.Font = 'Microsoft Sans Serif,10' $RemoveRegkeys.Font = 'Microsoft Sans Serif,10'
$UnpinStartMenuTiles = New-Object system.Windows.Forms.Button $UnpinStartMenuTiles = New-Object System.Windows.Forms.Button
$UnpinStartMenuTiles.text = "Unpin Tiles From Start Menu" $UnpinStartMenuTiles.Text = "Unpin Tiles From Start Menu"
$UnpinStartMenuTiles.width = 190 $UnpinStartMenuTiles.Width = 190
$UnpinStartMenuTiles.height = 35 $UnpinStartMenuTiles.Height = 35
$UnpinStartMenuTiles.location = New-Object System.Drawing.Point(540, 217) $UnpinStartMenuTiles.Location = New-Object System.Drawing.Point(540, 217)
$UnpinStartMenuTiles.Font = 'Microsoft Sans Serif,10' $UnpinStartMenuTiles.Font = 'Microsoft Sans Serif,10'
$RemoveOnedrive = New-Object system.Windows.Forms.Button $RemoveOnedrive = New-Object System.Windows.Forms.Button
$RemoveOnedrive.text = "Uninstall OneDrive" $RemoveOnedrive.Text = "Uninstall OneDrive"
$RemoveOnedrive.width = 152 $RemoveOnedrive.Width = 152
$RemoveOnedrive.height = 35 $RemoveOnedrive.Height = 35
$RemoveOnedrive.location = New-Object System.Drawing.Point(365, 217) $RemoveOnedrive.Location = New-Object System.Drawing.Point(365, 217)
$RemoveOnedrive.Font = 'Microsoft Sans Serif,10' $RemoveOnedrive.Font = 'Microsoft Sans Serif,10'
#$FixWhitelist = New-Object system.Windows.Forms.Button #$FixWhitelist = New-Object System.Windows.Forms.Button
#$FixWhitelist.text = "Fix Whitelisted Apps" #$FixWhitelist.Text = "Fix Whitelisted Apps"
#$FixWhitelist.width = 130 #$FixWhitelist.Width = 130
#$FixWhitelist.height = 37 #$FixWhitelist.Height = 37
#$FixWhitelist.location = New-Object System.Drawing.Point(254, 74) #$FixWhitelist.Location = New-Object System.Drawing.Point(254, 74)
#$FixWhitelist.Font = 'Microsoft Sans Serif,10' #$FixWhitelist.Font = 'Microsoft Sans Serif,10'
$InstallNet35 = New-Object system.Windows.Forms.Button $InstallNet35 = New-Object System.Windows.Forms.Button
$InstallNet35.text = "Install .NET v3.5" $InstallNet35.Text = "Install .NET v3.5"
$InstallNet35.width = 152 $InstallNet35.Width = 152
$InstallNet35.height = 39 $InstallNet35.Height = 39
$InstallNet35.location = New-Object System.Drawing.Point(169, 335) $InstallNet35.Location = New-Object System.Drawing.Point(169, 335)
$InstallNet35.Font = 'Microsoft Sans Serif,10' $InstallNet35.Font = 'Microsoft Sans Serif,10'
$EnableDarkMode = New-Object system.Windows.Forms.Button $EnableDarkMode = New-Object System.Windows.Forms.Button
$EnableDarkMode.text = "Enable Dark Mode" $EnableDarkMode.Text = "Enable Dark Mode"
$EnableDarkMode.width = 152 $EnableDarkMode.Width = 152
$EnableDarkMode.height = 39 $EnableDarkMode.Height = 39
$EnableDarkMode.location = New-Object System.Drawing.Point(9, 335) $EnableDarkMode.Location = New-Object System.Drawing.Point(9, 335)
$EnableDarkMode.Font = 'Microsoft Sans Serif,10' $EnableDarkMode.Font = 'Microsoft Sans Serif,10'
$DisableDarkMode = New-Object system.Windows.Forms.Button $DisableDarkMode = New-Object System.Windows.Forms.Button
$DisableDarkMode.text = "Disable Dark Mode" $DisableDarkMode.Text = "Disable Dark Mode"
$DisableDarkMode.width = 152 $DisableDarkMode.Width = 152
$DisableDarkMode.height = 39 $DisableDarkMode.Height = 39
$DisableDarkMode.location = New-Object System.Drawing.Point(9, 385) $DisableDarkMode.Location = New-Object System.Drawing.Point(9, 385)
$DisableDarkMode.Font = 'Microsoft Sans Serif,10' $DisableDarkMode.Font = 'Microsoft Sans Serif,10'
@ -347,33 +355,33 @@ $Form.controls.AddRange(@($Debloat, $CustomizeBlacklists, $RemoveAllBloatware, $
$DebloatFolder = "C:\Temp\Windows10Debloater" $DebloatFolder = "C:\Temp\Windows10Debloater"
If (Test-Path $DebloatFolder) { If (Test-Path $DebloatFolder) {
Write-Host "$DebloatFolder exists. Skipping." Write-Host "${DebloatFolder} exists. Skipping."
} }
Else { Else {
Write-Host "The folder "$DebloatFolder" doesn't exist. This folder will be used for storing logs created after the script runs. Creating now." Write-Host "The folder ${DebloatFolder} doesn't exist. This folder will be used for storing logs created after the script runs. Creating now."
Start-Sleep 1 Start-Sleep 1
New-Item -Path "$DebloatFolder" -ItemType Directory New-Item -Path "${DebloatFolder}" -ItemType Directory
Write-Host "The folder $DebloatFolder was successfully created." Write-Host "The folder ${DebloatFolder} was successfully created."
} }
Start-Transcript -OutputDirectory "$DebloatFolder" Start-Transcript -OutputDirectory "${DebloatFolder}"
#region gui events { #region gui events {
$CustomizeBlacklists.Add_Click( { $CustomizeBlacklists.Add_Click( {
$CustomizeForm = New-Object system.Windows.Forms.Form $CustomizeForm = New-Object System.Windows.Forms.Form
$CustomizeForm.ClientSize = '600,400' $CustomizeForm.ClientSize = '600,400'
$CustomizeForm.text = "Customize Whitelist and Blacklist" $CustomizeForm.Text = "Customize Whitelist and Blacklist"
$CustomizeForm.TopMost = $false $CustomizeForm.TopMost = $false
$CustomizeForm.AutoScroll = $true $CustomizeForm.AutoScroll = $true
$SaveList = New-Object system.Windows.Forms.Button $SaveList = New-Object System.Windows.Forms.Button
$SaveList.text = "Save custom Whitelist and Blacklist to custom-lists.ps1" $SaveList.Text = "Save custom Whitelist and Blacklist to custom-lists.ps1"
$SaveList.AutoSize = $true $SaveList.AutoSize = $true
$SaveList.location = New-Object System.Drawing.Point(200, 5) $SaveList.Location = New-Object System.Drawing.Point(200, 5)
$CustomizeForm.controls.Add($SaveList) $CustomizeForm.controls.Add($SaveList)
$SaveList.Add_Click( { $SaveList.Add_Click( {
$ErrorActionPreference = 'silentlycontinue' $ErrorActionPreference = 'SilentlyContinue'
'$global:WhiteListedApps = @(' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Encoding utf8 '$global:WhiteListedApps = @(' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Encoding utf8
@($CustomizeForm.controls) | ForEach { @($CustomizeForm.controls) | ForEach {
@ -413,17 +421,17 @@ $CustomizeBlacklists.Add_Click( {
[string] $notes [string] $notes
) )
$label = New-Object system.Windows.Forms.Label $label = New-Object System.Windows.Forms.Label
$label.Location = New-Object System.Drawing.Point(2, (30 + $position * 16)) $label.Location = New-Object System.Drawing.Point(2, (30 + $position * 16))
$label.Text = $notes $label.Text = $notes
$label.width = 300 $label.Width = 300
$label.height = 16 $label.Height = 16
$Label.TextAlign = [System.Drawing.ContentAlignment]::TopRight $Label.TextAlign = [System.Drawing.ContentAlignment]::TopRight
$CustomizeForm.controls.Add($label) $CustomizeForm.controls.Add($label)
$Checkbox = New-Object system.Windows.Forms.CheckBox $Checkbox = New-Object System.Windows.Forms.CheckBox
$Checkbox.text = $appName $Checkbox.Text = $appName
$Checkbox.location = New-Object System.Drawing.Point(320, (30 + $position * 16)) $Checkbox.Location = New-Object System.Drawing.Point(320, (30 + $position * 16))
$Checkbox.Autosize = 1; $Checkbox.Autosize = 1;
$Checkbox.Checked = $checked $Checkbox.Checked = $checked
$Checkbox.Enabled = $enabled $Checkbox.Enabled = $enabled
@ -436,7 +444,7 @@ $CustomizeBlacklists.Add_Click( {
$AllUsers = @( (Get-AppxPackage -AllUsers).Name ) $AllUsers = @( (Get-AppxPackage -AllUsers).Name )
[int]$checkboxCounter = 0 [int]$checkboxCounter = 0
foreach ($item in $NonRemovables) { ForEach ($item in $NonRemovables) {
$string = "" $string = ""
if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { $string += " ConflictBlacklist " } if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { $string += " ConflictBlacklist " }
if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { $string += " ConflictWhitelist" } if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { $string += " ConflictWhitelist" }
@ -447,7 +455,7 @@ $CustomizeBlacklists.Add_Click( {
AddAppToCustomizeForm $checkboxCounter $item $false $false $string AddAppToCustomizeForm $checkboxCounter $item $false $false $string
++$checkboxCounter ++$checkboxCounter
} }
foreach ( $item in $global:WhiteListedApps ) { ForEach ( $item in $global:WhiteListedApps ) {
$string = "" $string = ""
if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { $string += " Conflict NonRemovables " } if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { $string += " Conflict NonRemovables " }
if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { $string += " ConflictBlacklist " } if ( $null -notmatch $global:BloatwareRegex -and $item -cmatch $global:BloatwareRegex ) { $string += " ConflictBlacklist " }
@ -457,7 +465,7 @@ $CustomizeBlacklists.Add_Click( {
AddAppToCustomizeForm $checkboxCounter $item $true $false $string AddAppToCustomizeForm $checkboxCounter $item $true $false $string
++$checkboxCounter ++$checkboxCounter
} }
foreach ( $item in $global:Bloatware ) { ForEach ( $item in $global:Bloatware ) {
$string = "" $string = ""
if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { $string += " Conflict NonRemovables " } if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { $string += " Conflict NonRemovables " }
if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { $string += " Conflict Whitelist " } if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { $string += " Conflict Whitelist " }
@ -467,7 +475,7 @@ $CustomizeBlacklists.Add_Click( {
AddAppToCustomizeForm $checkboxCounter $item $true $true $string AddAppToCustomizeForm $checkboxCounter $item $true $true $string
++$checkboxCounter ++$checkboxCounter
} }
foreach ( $item in $AllUsers ) { ForEach ( $item in $AllUsers ) {
$string = "NEW AllUsers" $string = "NEW AllUsers"
if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue } if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue }
if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue } if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue }
@ -477,7 +485,7 @@ $CustomizeBlacklists.Add_Click( {
AddAppToCustomizeForm $checkboxCounter $item $true $true $string AddAppToCustomizeForm $checkboxCounter $item $true $true $string
++$checkboxCounter ++$checkboxCounter
} }
foreach ( $item in $Installed ) { ForEach ( $item in $Installed ) {
$string = "NEW Installed" $string = "NEW Installed"
if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue } if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue }
if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue } if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue }
@ -487,7 +495,7 @@ $CustomizeBlacklists.Add_Click( {
AddAppToCustomizeForm $checkboxCounter $item $true $true $string AddAppToCustomizeForm $checkboxCounter $item $true $true $string
++$checkboxCounter ++$checkboxCounter
} }
foreach ( $item in $Online ) { ForEach ( $item in $Online ) {
$string = "NEW Online " $string = "NEW Online "
if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue } if ( $null -notmatch $NonRemovables -and $NonRemovables -cmatch $item ) { continue }
if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue } if ( $null -notmatch $global:WhiteListedAppsRegex -and $item -cmatch $global:WhiteListedAppsRegex ) { continue }
@ -503,7 +511,7 @@ $CustomizeBlacklists.Add_Click( {
$RemoveBlacklist.Add_Click( { $RemoveBlacklist.Add_Click( {
$ErrorActionPreference = 'silentlycontinue' $ErrorActionPreference = 'SilentlyContinue'
Function DebloatBlacklist { Function DebloatBlacklist {
Write-Host "Requesting removal of $global:BloatwareRegex" Write-Host "Requesting removal of $global:BloatwareRegex"
Write-Host "--- This may take a while - please be patient ---" Write-Host "--- This may take a while - please be patient ---"
@ -518,7 +526,7 @@ $RemoveBlacklist.Add_Click( {
Write-Host "Bloatware removed!" Write-Host "Bloatware removed!"
}) })
$RemoveAllBloatware.Add_Click( { $RemoveAllBloatware.Add_Click( {
$ErrorActionPreference = 'silentlycontinue' $ErrorActionPreference = 'SilentlyContinue'
#This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos. #This function finds any AppX/AppXProvisioned package and uninstalls it, except for Freshpaint, Windows Calculator, Windows Store, and Windows Photos.
#Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc. #Also, to note - This does NOT remove essential system services/software/etc such as .NET framework installations, Cortana, Edge, etc.
@ -777,7 +785,7 @@ $RemoveAllBloatware.Add_Click( {
} ) } )
$RevertChange.Add_Click( { $RevertChange.Add_Click( {
$ErrorActionPreference = 'silentlycontinue' $ErrorActionPreference = 'SilentlyContinue'
#This function will revert the changes you made when running the Start-Debloat function. #This function will revert the changes you made when running the Start-Debloat function.
#This line reinstalls all of the bloatware that was removed #This line reinstalls all of the bloatware that was removed
@ -872,7 +880,7 @@ $RevertChange.Add_Click( {
Write-Host "Done reverting changes!" Write-Host "Done reverting changes!"
# #
Write-Output "Restoring 3D Objects from explorer 'My Computer' submenu" Write-Output "Restoring 3D Objects from Explorer 'My Computer' submenu"
$Objects32 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" $Objects32 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
$Objects64 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}" $Objects64 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
If (!(Test-Path $Objects32)) { If (!(Test-Path $Objects32)) {
@ -883,7 +891,7 @@ $RevertChange.Add_Click( {
} }
}) })
$DisableCortana.Add_Click( { $DisableCortana.Add_Click( {
$ErrorActionPreference = 'silentlycontinue' $ErrorActionPreference = 'SilentlyContinue'
Write-Host "Disabling Cortana" Write-Host "Disabling Cortana"
$Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
$Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization" $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
@ -904,7 +912,7 @@ $DisableCortana.Add_Click( {
Write-Host "Cortana has been disabled." Write-Host "Cortana has been disabled."
}) })
$StopEdgePDFTakeover.Add_Click( { $StopEdgePDFTakeover.Add_Click( {
$ErrorActionPreference = 'silentlycontinue' $ErrorActionPreference = 'SilentlyContinue'
#Stops edge from taking over as the default .PDF viewer #Stops edge from taking over as the default .PDF viewer
Write-Host "Stopping Edge from taking over as the default .PDF viewer" Write-Host "Stopping Edge from taking over as the default .PDF viewer"
$NoPDF = "HKCR:\.pdf" $NoPDF = "HKCR:\.pdf"
@ -937,7 +945,7 @@ $StopEdgePDFTakeover.Add_Click( {
Write-Host "Edge should no longer take over as the default .PDF." Write-Host "Edge should no longer take over as the default .PDF."
}) })
$EnableCortana.Add_Click( { $EnableCortana.Add_Click( {
$ErrorActionPreference = 'silentlycontinue' $ErrorActionPreference = 'SilentlyContinue'
Write-Host "Re-enabling Cortana" Write-Host "Re-enabling Cortana"
$Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings" $Cortana1 = "HKCU:\SOFTWARE\Microsoft\Personalization\Settings"
$Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization" $Cortana2 = "HKCU:\SOFTWARE\Microsoft\InputPersonalization"
@ -959,7 +967,7 @@ $EnableCortana.Add_Click( {
}) })
$EnableEdgePDFTakeover.Add_Click( { $EnableEdgePDFTakeover.Add_Click( {
New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
$ErrorActionPreference = 'silentlycontinue' $ErrorActionPreference = 'SilentlyContinue'
Write-Host "Setting Edge back to default" Write-Host "Setting Edge back to default"
$NoPDF = "HKCR:\.pdf" $NoPDF = "HKCR:\.pdf"
$NoProgids = "HKCR:\.pdf\OpenWithProgids" $NoProgids = "HKCR:\.pdf\OpenWithProgids"
@ -992,7 +1000,7 @@ $EnableEdgePDFTakeover.Add_Click( {
Write-Host "Edge will now be able to be used for .PDF." Write-Host "Edge will now be able to be used for .PDF."
}) })
$DisableTelemetry.Add_Click( { $DisableTelemetry.Add_Click( {
$ErrorActionPreference = 'silentlycontinue' $ErrorActionPreference = 'SilentlyContinue'
#Disables Windows Feedback Experience #Disables Windows Feedback Experience
Write-Host "Disabling Windows Feedback Experience program" Write-Host "Disabling Windows Feedback Experience program"
$Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo" $Advertising = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo"
@ -1036,12 +1044,12 @@ $DisableTelemetry.Add_Click( {
If (!(Test-Path $registryOEM)) { If (!(Test-Path $registryOEM)) {
New-Item $registryOEM New-Item $registryOEM
} }
Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0 Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0 Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0 Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0 Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0 Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0 Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
#Preping mixed Reality Portal for removal #Preping mixed Reality Portal for removal
Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings" Write-Host "Setting Mixed Reality Portal value to 0 so that you can uninstall it in Settings"
@ -1110,12 +1118,12 @@ $DisableTelemetry.Add_Click( {
#Disables scheduled tasks that are considered unnecessary #Disables scheduled tasks that are considered unnecessary
Write-Host "Disabling scheduled tasks" Write-Host "Disabling scheduled tasks"
#Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask #Get-ScheduledTask XblGameSaveTaskLogon | Disable-ScheduledTask
Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask Get-ScheduledTask XblGameSaveTask | Disable-ScheduledTask
Get-ScheduledTask Consolidator | Disable-ScheduledTask Get-ScheduledTask Consolidator | Disable-ScheduledTask
Get-ScheduledTask UsbCeip | Disable-ScheduledTask Get-ScheduledTask UsbCeip | Disable-ScheduledTask
Get-ScheduledTask DmClient | Disable-ScheduledTask Get-ScheduledTask DmClient | Disable-ScheduledTask
Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask Get-ScheduledTask DmClientOnScenarioDownload | Disable-ScheduledTask
#Write-Host "Uninstalling Telemetry Windows Updates" #Write-Host "Uninstalling Telemetry Windows Updates"
#Uninstalls Some Windows Updates considered to be Telemetry. !WIP! #Uninstalls Some Windows Updates considered to be Telemetry. !WIP!
@ -1136,7 +1144,7 @@ $DisableTelemetry.Add_Click( {
Write-Host "Telemetry has been disabled!" Write-Host "Telemetry has been disabled!"
}) })
$RemoveRegkeys.Add_Click( { $RemoveRegkeys.Add_Click( {
$ErrorActionPreference = 'silentlycontinue' $ErrorActionPreference = 'SilentlyContinue'
$Keys = @( $Keys = @(
New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT New-PSDrive HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT

Loading…
Cancel
Save