From 72043ee7d25d9f89f437b60909e7e581cadfe75a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn?= Date: Thu, 15 Sep 2022 12:50:38 -0300 Subject: [PATCH] Fix invalid flag value after applying misc tweaks (#141) * Update README.md * QOL Terminal - Win Update Revamp * Fix Flickering * Fix invalid flag value after applying misc tweaks Adjusting visual effects for performance... Adjusted visual effects for performance false: Line | 964 | $WPFMiscTweaksDisplay.IsChecked = false | ~~~~~ | The term 'false' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. Co-authored-by: Chris Titus --- README.md | 2 + winutil.ps1 | 195 ++++++++++++++++------------------------------------ 2 files changed, 60 insertions(+), 137 deletions(-) diff --git a/README.md b/README.md index 87335e2a..d1dae784 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ Launch Command: iwr -useb https://christitus.com/win | iex ``` +EXE Wrapper for $5 @ https://www.cttstore.com/windows-toolbox + ## Overview - Install diff --git a/winutil.ps1 b/winutil.ps1 index 6a1b1a95..1aece728 100644 --- a/winutil.ps1 +++ b/winutil.ps1 @@ -497,6 +497,10 @@ $WPFinstall.Add_Click({ [System.Windows.MessageBox]::Show($Messageboxbody, $AppTitle, $ButtonType, $MessageIcon) + Write-Host "=================================" + Write-Host "--- Installs are Finished ---" + Write-Host "=================================" + }) $WPFInstallUpgrade.Add_Click({ @@ -861,7 +865,8 @@ $WPFtweaksbutton.Add_Click({ Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control" -Name "WaitToKillServiceTimeout" -Type DWord -Value 2000 Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "MenuShowDelay" -Type DWord -Value 1 Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "WaitToKillAppTimeout" -Type DWord -Value 5000 - Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "HungAppTimeout" -Type DWord -Value 4000 + Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "HungAppTimeout" -ErrorAction SilentlyContinue + # Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "HungAppTimeout" -Type DWord -Value 4000 # Note: This caused flickering Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "AutoEndTasks" -Type DWord -Value 1 Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "LowLevelHooksTimeout" -Type DWord -Value 1000 Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "WaitToKillServiceTimeout" -Type DWord -Value 2000 @@ -970,7 +975,7 @@ $WPFtweaksbutton.Add_Click({ Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualFXSetting" -Type DWord -Value 3 Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "EnableAeroPeek" -Type DWord -Value 0 Write-Host "Adjusted visual effects for performance" - $WPFMiscTweaksDisplay.IsChecked = false + $WPFMiscTweaksDisplay.IsChecked = $false } If ( $WPFEssTweaksDeBloat.IsChecked -eq $true ) { @@ -1222,7 +1227,7 @@ $WPFundoall.Add_Click({ Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "TaskbarAnimations" -Type DWord -Value 1 Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects" -Name "VisualFXSetting" -Type DWord -Value 3 Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\DWM" -Name "EnableAeroPeek" -Type DWord -Value 1 - + Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "HungAppTimeout" -ErrorAction SilentlyContinue Write-Host "Restoring Clipboard History..." Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Clipboard" -Name "EnableClipboardHistory" -ErrorAction SilentlyContinue Remove-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System" -Name "AllowClipboardHistory" -ErrorAction SilentlyContinue @@ -1236,6 +1241,10 @@ $WPFundoall.Add_Click({ $MessageIcon = [System.Windows.MessageBoxImage]::Information [System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon) + + Write-Host "=================================" + Write-Host "--- Undo All is Finished ---" + Write-Host "=================================" }) #=========================================================================== # Tab 3 - Config Buttons @@ -1286,6 +1295,10 @@ $WPFFeatureInstall.Add_Click({ $MessageIcon = [System.Windows.MessageBoxImage]::Information [System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon) + + Write-Host "=================================" + Write-Host "--- Features are Installed ---" + Write-Host "=================================" }) $WPFPanelDISM.Add_Click({ @@ -1319,67 +1332,16 @@ $WPFPaneluser.Add_Click({ #=========================================================================== $WPFUpdatesdefault.Add_Click({ - # Source: https://github.com/rgl/windows-vagrant/blob/master/disable-windows-updates.ps1 reversed! - Set-StrictMode -Version Latest - $ProgressPreference = 'SilentlyContinue' - $ErrorActionPreference = 'Stop' - - # disable automatic updates. - # XXX this does not seem to work anymore. - # see How to configure automatic updates by using Group Policy or registry settings - # at https://support.microsoft.com/en-us/help/328010 - function New-Directory($path) { - $p, $components = $path -split '[\\/]' - $components | ForEach-Object { - $p = "$p\$_" - If (!(Test-Path $p)) { - New-Item -ItemType Directory $p | Out-Null - } - } - $null + If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU")) { + New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Force | Out-Null } - $auPath = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' - New-Directory $auPath - # set NoAutoUpdate. - # 0: Automatic Updates is enabled (default). - # 1: Automatic Updates is disabled. - New-ItemProperty ` - -Path $auPath ` - -Name NoAutoUpdate ` - -Value 0 ` - -PropertyType DWORD ` - -Force ` - | Out-Null - # set AUOptions. - # 1: Keep my computer up to date has been disabled in Automatic Updates. - # 2: Notify of download and installation. - # 3: Automatically download and notify of installation. - # 4: Automatically download and scheduled installation. - New-ItemProperty ` - -Path $auPath ` - -Name AUOptions ` - -Value 3 ` - -PropertyType DWORD ` - -Force ` - | Out-Null - - # disable Windows Update Delivery Optimization. - # NB this applies to Windows 10. - # 0: Disabled - # 1: PCs on my local network - # 3: PCs on my local network, and PCs on the Internet - $deliveryOptimizationPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config' - If (Test-Path $deliveryOptimizationPath) { - New-ItemProperty ` - -Path $deliveryOptimizationPath ` - -Name DODownloadMode ` - -Value 0 ` - -PropertyType DWORD ` - -Force ` - | Out-Null + Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoUpdate" -Type DWord -Value 0 + Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -Type DWord -Value 3 + If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config")) { + New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Force | Out-Null } - # Service tweaks for Windows Update - + Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -Type DWord -Value 1 + $services = @( "BITS" "wuauserv" @@ -1404,6 +1366,9 @@ $WPFUpdatesdefault.Add_Click({ Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "BranchReadinessLevel" -ErrorAction SilentlyContinue Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "DeferFeatureUpdatesPeriodInDays" -ErrorAction SilentlyContinue Remove-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsUpdate\UX\Settings" -Name "DeferQualityUpdatesPeriodInDays " -ErrorAction SilentlyContinue + Write-Host "=================================" + Write-Host "--- Updates Set to Default ---" + Write-Host "=================================" }) $WPFFixesUpdate.Add_Click({ @@ -1413,8 +1378,6 @@ $WPFFixesUpdate.Add_Click({ Stop-Service -Name wuauserv Stop-Service -Name appidsvc Stop-Service -Name cryptsvc - - Write-Host "2. Remove QMGR Data file..." Remove-Item "$env:allusersprofile\Application Data\Microsoft\Network\Downloader\qmgr*.dat" -ErrorAction SilentlyContinue @@ -1429,7 +1392,6 @@ $WPFFixesUpdate.Add_Click({ Write-Host "5. Resetting the Windows Update Services to defualt settings..." "sc.exe sdset bits D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)" "sc.exe sdset wuauserv D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)" - Set-Location $env:systemroot\system32 Write-Host "6. Registering some DLLs..." @@ -1478,6 +1440,7 @@ $WPFFixesUpdate.Add_Click({ Write-Host "8) Resetting the WinSock..." netsh winsock reset netsh winhttp reset proxy + netsh int ip reset Write-Host "9) Delete all BITS jobs..." Get-BitsTransfer | Remove-BitsTransfer @@ -1507,82 +1470,37 @@ $WPFFixesUpdate.Add_Click({ $MessageIcon = [System.Windows.MessageBoxImage]::Information [System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon) + Write-Host "=================================" + Write-Host "-- Reset ALL Updates to Factory -" + Write-Host "=================================" }) + $WPFUpdatesdisable.Add_Click({ - # Source: https://github.com/rgl/windows-vagrant/blob/master/disable-windows-updates.ps1 - Set-StrictMode -Version Latest - $ProgressPreference = 'SilentlyContinue' - $ErrorActionPreference = 'Stop' + If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU")) { + New-Item -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Force | Out-Null + } + Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "NoAutoUpdate" -Type DWord -Value 1 + Set-ItemProperty -Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU" -Name "AUOptions" -Type DWord -Value 1 + If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config")) { + New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Force | Out-Null + } + Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" -Name "DODownloadMode" -Type DWord -Value 0 + + $services = @( + "BITS" + "wuauserv" + ) - # disable automatic updates. - # XXX this does not seem to work anymore. - # see How to configure automatic updates by using Group Policy or registry settings - # at https://support.microsoft.com/en-us/help/328010 - function New-Directory($path) { - $p, $components = $path -split '[\\/]' - $components | ForEach-Object { - $p = "$p\$_" - If (!(Test-Path $p)) { - New-Item -ItemType Directory $p | Out-Null - } - } - $null - } - $auPath = 'HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU' - New-Directory $auPath - # set NoAutoUpdate. - # 0: Automatic Updates is enabled (default). - # 1: Automatic Updates is disabled. - New-ItemProperty ` - -Path $auPath ` - -Name NoAutoUpdate ` - -Value 1 ` - -PropertyType DWORD ` - -Force ` - | Out-Null - # set AUOptions. - # 1: Keep my computer up to date has been disabled in Automatic Updates. - # 2: Notify of download and installation. - # 3: Automatically download and notify of installation. - # 4: Automatically download and scheduled installation. - New-ItemProperty ` - -Path $auPath ` - -Name AUOptions ` - -Value 1 ` - -PropertyType DWORD ` - -Force ` - | Out-Null + foreach ($service in $services) { + # -ErrorAction SilentlyContinue is so it doesn't write an error to stdout if a service doesn't exist - # disable Windows Update Delivery Optimization. - # NB this applies to Windows 10. - # 0: Disabled - # 1: PCs on my local network - # 3: PCs on my local network, and PCs on the Internet - $deliveryOptimizationPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config' - If (Test-Path $deliveryOptimizationPath) { - New-ItemProperty ` - -Path $deliveryOptimizationPath ` - -Name DODownloadMode ` - -Value 0 ` - -PropertyType DWORD ` - -Force ` - | Out-Null - } - # Service tweaks for Windows Update - - $services = @( - "BITS" - "wuauserv" - ) - - foreach ($service in $services) { - # -ErrorAction SilentlyContinue is so it doesn't write an error to stdout if a service doesn't exist - - Write-Host "Setting $service StartupType to Disabled" - Get-Service -Name $service -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled - } - - }) + Write-Host "Setting $service StartupType to Disabled" + Get-Service -Name $service -ErrorAction SilentlyContinue | Set-Service -StartupType Disabled + } + Write-Host "=================================" + Write-Host "--- Updates ARE DISABLED ---" + Write-Host "=================================" +}) $WPFUpdatessecurity.Add_Click({ Write-Host "Disabling driver offering through Windows Update..." If (!(Test-Path "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Device Metadata")) { @@ -1616,6 +1534,9 @@ $WPFUpdatessecurity.Add_Click({ $MessageIcon = [System.Windows.MessageBoxImage]::Information [System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon) + Write-Host "=================================" + Write-Host "-- Updates Set to Recommended ---" + Write-Host "=================================" }) #===========================================================================