From 6905b04b003fa7c45139676d0b8c16031a79481c Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Mon, 5 Sep 2022 20:33:54 -0500 Subject: [PATCH] Remove trap function --- .gitignore | 1 + winutil.ps1 | 21 +-------------------- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 02ec6d89..4b9986ff 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ Microsoft.PowerShell.ConsoleHost.dll winutil.exe.config winutil.pdb *.zip +package.psd1 diff --git a/winutil.ps1 b/winutil.ps1 index 9198387e..dc6affe0 100644 --- a/winutil.ps1 +++ b/winutil.ps1 @@ -1262,16 +1262,6 @@ $WPFUpdatesdefault.Add_Click({ Set-StrictMode -Version Latest $ProgressPreference = 'SilentlyContinue' $ErrorActionPreference = 'Stop' - trap { - Write-Host - Write-Host "ERROR: $_" - Write-Host (($_.ScriptStackTrace -split '\r?\n') -replace '^(.*)$', 'ERROR: $1') - Write-Host (($_.Exception.ToString() -split '\r?\n') -replace '^(.*)$', 'ERROR EXCEPTION: $1') - Write-Host - Write-Host 'Sleeping for 60m to give you time to look around the virtual machine before self-destruction...' - Start-Sleep -Seconds (60 * 60) - Exit 1 - } # disable automatic updates. # XXX this does not seem to work anymore. @@ -1354,6 +1344,7 @@ $WPFUpdatesdefault.Add_Click({ 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 }) + $WPFFixesUpdate.Add_Click({ ### Reset Windows Update Script - reregister dlls, services, and remove registry entires. Write-Host "1. Stopping Windows Update Services..." @@ -1461,16 +1452,6 @@ $WPFUpdatesdisable.Add_Click({ Set-StrictMode -Version Latest $ProgressPreference = 'SilentlyContinue' $ErrorActionPreference = 'Stop' - trap { - Write-Host - Write-Host "ERROR: $_" - Write-Host (($_.ScriptStackTrace -split '\r?\n') -replace '^(.*)$', 'ERROR: $1') - Write-Host (($_.Exception.ToString() -split '\r?\n') -replace '^(.*)$', 'ERROR EXCEPTION: $1') - Write-Host - Write-Host 'Sleeping for 60m to give you time to look around the virtual machine before self-destruction...' - Start-Sleep -Seconds (60 * 60) - Exit 1 - } # disable automatic updates. # XXX this does not seem to work anymore.