Remove trap function

This commit is contained in:
Chris Titus 2022-09-05 20:33:54 -05:00
parent fecc54d71d
commit 6905b04b00
2 changed files with 2 additions and 20 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ Microsoft.PowerShell.ConsoleHost.dll
winutil.exe.config
winutil.pdb
*.zip
package.psd1

View File

@ -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.