Fixed CustomList not saving

The customlist was not saving as explained in issue #345. The issue was that on lines 529 and 537 it was set as $CustomizeForm.Controls when it should have instead been $ListPanel.Controls. Verified that the fix works.
pull/261/head^2
Richard Newton 3 years ago committed by GitHub
parent 0d558e787b
commit 01770eb21d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -35,7 +35,6 @@ If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:
} }
} }
#Unnecessary Windows 10 AppX apps that will be removed by the blacklist. #Unnecessary Windows 10 AppX apps that will be removed by the blacklist.
$global:Bloatware = @( $global:Bloatware = @(
"Microsoft.PPIProjection" "Microsoft.PPIProjection"
@ -218,7 +217,7 @@ $Form.FormBorderStyle = 'FixedSingle'
$Form.MinimizeBox = $false $Form.MinimizeBox = $false
$Form.MaximizeBox = $false $Form.MaximizeBox = $false
$Form.ShowIcon = $false $Form.ShowIcon = $false
$Form.text = "Windows10Debloater" $Form.text = "Windows10Debloader"
$Form.TopMost = $false $Form.TopMost = $false
$Form.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#252525") $Form.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#252525")
@ -270,7 +269,7 @@ $Debloat.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#
$CustomizeBlacklist = New-Object system.Windows.Forms.Button $CustomizeBlacklist = New-Object system.Windows.Forms.Button
$CustomizeBlacklist.FlatStyle = 'Flat' $CustomizeBlacklist.FlatStyle = 'Flat'
$CustomizeBlacklist.text = "CUSTOMISE BLOCKLIST" $CustomizeBlacklist.text = "CUSTOMISE BLACKLIST"
$CustomizeBlacklist.width = 460 $CustomizeBlacklist.width = 460
$CustomizeBlacklist.height = 30 $CustomizeBlacklist.height = 30
$CustomizeBlacklist.Anchor = 'top,right,left' $CustomizeBlacklist.Anchor = 'top,right,left'
@ -290,7 +289,7 @@ $RemoveAllBloatware.ForeColor = [System.Drawing.ColorTranslator]::FromHtml("#
$RemoveBlacklistedBloatware = New-Object system.Windows.Forms.Button $RemoveBlacklistedBloatware = New-Object system.Windows.Forms.Button
$RemoveBlacklistedBloatware.FlatStyle = 'Flat' $RemoveBlacklistedBloatware.FlatStyle = 'Flat'
$RemoveBlacklistedBloatware.text = "REMOVE BLOATWARE WITH CUSTOM BLOCKLIST" $RemoveBlacklistedBloatware.text = "REMOVE BLOATWARE WITH CUSTOM BLACKLIST"
$RemoveBlacklistedBloatware.width = 460 $RemoveBlacklistedBloatware.width = 460
$RemoveBlacklistedBloatware.height = 30 $RemoveBlacklistedBloatware.height = 30
$RemoveBlacklistedBloatware.Anchor = 'top,right,left' $RemoveBlacklistedBloatware.Anchor = 'top,right,left'
@ -489,10 +488,6 @@ Else {
Start-Transcript -OutputDirectory "${DebloatFolder}" Start-Transcript -OutputDirectory "${DebloatFolder}"
Write-Output "Creating System Restore Point if one does not already exist. If one does, then you will receive a warning. Please wait..."
Checkpoint-Computer -Description "Before using W10DebloaterGUI.ps1"
#region gui events { #region gui events {
$CustomizeBlacklist.Add_Click( { $CustomizeBlacklist.Add_Click( {
$CustomizeForm = New-Object System.Windows.Forms.Form $CustomizeForm = New-Object System.Windows.Forms.Form
@ -502,7 +497,7 @@ $CustomizeBlacklist.Add_Click( {
$CustomizeForm.MinimizeBox = $false $CustomizeForm.MinimizeBox = $false
$CustomizeForm.MaximizeBox = $false $CustomizeForm.MaximizeBox = $false
$CustomizeForm.ShowIcon = $false $CustomizeForm.ShowIcon = $false
$CustomizeForm.Text = "Customize Allowlist and Blocklist" $CustomizeForm.Text = "Customize Whitelist and Blacklist"
$CustomizeForm.TopMost = $false $CustomizeForm.TopMost = $false
$CustomizeForm.AutoScroll = $false $CustomizeForm.AutoScroll = $false
$CustomizeForm.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#252525") $CustomizeForm.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#252525")
@ -518,7 +513,7 @@ $CustomizeBlacklist.Add_Click( {
$SaveList = New-Object System.Windows.Forms.Button $SaveList = New-Object System.Windows.Forms.Button
$SaveList.FlatStyle = 'Flat' $SaveList.FlatStyle = 'Flat'
$SaveList.Text = "Save custom Allowlist and Blocklist to custom-lists.ps1" $SaveList.Text = "Save custom Whitelist and Blacklist to custom-lists.ps1"
$SaveList.width = 480 $SaveList.width = 480
$SaveList.height = 30 $SaveList.height = 30
$SaveList.Location = New-Object System.Drawing.Point(10, 530) $SaveList.Location = New-Object System.Drawing.Point(10, 530)
@ -531,7 +526,7 @@ $CustomizeBlacklist.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 { @($ListPanel.controls) | ForEach {
if ($_ -is [System.Windows.Forms.CheckBox] -and $_.Enabled -and !$_.Checked) { if ($_ -is [System.Windows.Forms.CheckBox] -and $_.Enabled -and !$_.Checked) {
" ""$( $_.Text )""" | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8 " ""$( $_.Text )""" | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
} }
@ -539,7 +534,7 @@ $CustomizeBlacklist.Add_Click( {
')' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8 ')' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
'$global:Bloatware = @(' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8 '$global:Bloatware = @(' | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
@($CustomizeForm.controls) | ForEach { @($ListPanel.controls) | ForEach {
if ($_ -is [System.Windows.Forms.CheckBox] -and $_.Enabled -and $_.Checked) { if ($_ -is [System.Windows.Forms.CheckBox] -and $_.Enabled -and $_.Checked) {
" ""$($_.Text)""" | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8 " ""$($_.Text)""" | Out-File -FilePath $PSScriptRoot\custom-lists.ps1 -Append -Encoding utf8
} }
@ -675,7 +670,7 @@ $RemoveBlacklistedBloatware.Add_Click( {
Write-Host "...and the final cleanup..." Write-Host "...and the final cleanup..."
Get-AppxPackage -AllUsers | Where-Object Name -cmatch $global:BloatwareRegex | Remove-AppxPackage Get-AppxPackage -AllUsers | Where-Object Name -cmatch $global:BloatwareRegex | Remove-AppxPackage
} }
Write-Host "`n`n`n`n`n`n`n`n`n`n`n`n`n`n`n`n`nRemoving blocklisted Bloatware.`n" Write-Host "`n`n`n`n`n`n`n`n`n`n`n`n`n`n`n`n`nRemoving blacklisted Bloatware.`n"
DebloatBlacklist DebloatBlacklist
Write-Host "Bloatware removed!" Write-Host "Bloatware removed!"
}) })
@ -873,64 +868,43 @@ $RemoveAllBloatware.Add_Click( {
} }
Function UnpinStart { Function UnpinStart {
# https://superuser.com/a/1442733 #Credit to Vikingat-Rage
# Requires -RunAsAdministrator #https://superuser.com/questions/1068382/how-to-remove-all-the-tiles-in-the-windows-10-start-menu
#Unpins all tiles from the Start Menu
$START_MENU_LAYOUT = @" Write-Host "Unpinning all tiles from the start menu"
<LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" Version="1" xmlns:taskbar="http://schemas.microsoft.com/Start/2014/TaskbarLayout" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification"> (New-Object -Com Shell.Application).
<LayoutOptions StartTileGroupCellWidth="6" /> NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').
<DefaultLayoutOverride> Items() |
<StartLayoutCollection> % { $_.Verbs() } |
<defaultlayout:StartLayout GroupCellWidth="6" /> ? { $_.Name -match 'Un.*pin from Start' } |
</StartLayoutCollection> % { $_.DoIt() }
</DefaultLayoutOverride> }
</LayoutModificationTemplate>
"@ Function Remove3dObjects {
#Removes 3D Objects from the 'My Computer' submenu in explorer
$layoutFile="C:\Windows\StartMenuLayout.xml" Write-Output "Removing 3D Objects from explorer 'My Computer' submenu"
$Objects32 = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
#Delete layout file if it already exists $Objects64 = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}"
If(Test-Path $layoutFile) If (Test-Path $Objects32) {
{ Remove-Item $Objects32 -Recurse
Remove-Item $layoutFile }
If (Test-Path $Objects64) {
Remove-Item $Objects64 -Recurse
} }
}
#Creates the blank layout file
$START_MENU_LAYOUT | Out-File $layoutFile -Encoding ASCII
$regAliases = @("HKLM", "HKCU") Function CheckDMWService {
#Assign the start layout and force it to apply with "LockedStartLayout" at both the machine and user level Param([switch]$Debloat)
foreach ($regAlias in $regAliases){
$basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
$keyPath = $basePath + "\Explorer"
IF(!(Test-Path -Path $keyPath)) {
New-Item -Path $basePath -Name "Explorer"
}
Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 1
Set-ItemProperty -Path $keyPath -Name "StartLayoutFile" -Value $layoutFile
}
#Restart Explorer, open the start menu (necessary to load the new layout), and give it a few seconds to process If (Get-Service dmwappushservice | Where-Object { $_.StartType -eq "Disabled" }) {
Stop-Process -name explorer Set-Service dmwappushservice -StartupType Automatic
Start-Sleep -s 5
$wshell = New-Object -ComObject wscript.shell; $wshell.SendKeys('^{ESCAPE}')
Start-Sleep -s 5
#Enable the ability to pin items again by disabling "LockedStartLayout"
foreach ($regAlias in $regAliases){
$basePath = $regAlias + ":\SOFTWARE\Policies\Microsoft\Windows"
$keyPath = $basePath + "\Explorer"
Set-ItemProperty -Path $keyPath -Name "LockedStartLayout" -Value 0
} }
#Restart Explorer and delete the layout file If (Get-Service dmwappushservice | Where-Object { $_.Status -eq "Stopped" }) {
Stop-Process -name explorer Start-Service dmwappushservice
}
# Uncomment the next line to make clean start menu default for all new users
#Import-StartLayout -LayoutPath $layoutFile -MountPath $env:SystemDrive\
Remove-Item $layoutFile
} }
Function CheckInstallService { Function CheckInstallService {
@ -947,7 +921,7 @@ $START_MENU_LAYOUT = @"
DebloatAll DebloatAll
Write-Host "Removing leftover bloatware registry keys." Write-Host "Removing leftover bloatware registry keys."
Remove-Keys Remove-Keys
Write-Host "Checking to see if any Allowlisted Apps were removed, and if so re-adding them." Write-Host "Checking to see if any Whitelisted Apps were removed, and if so re-adding them."
FixWhitelistedApps FixWhitelistedApps
Write-Host "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning." Write-Host "Stopping telemetry, disabling unneccessary scheduled tasks, and preventing bloatware from returning."
Protect-Privacy Protect-Privacy

Loading…
Cancel
Save