Pause scripts on errors

This commit is contained in:
Manuel Thalmann 2024-03-23 17:32:45 +01:00
parent ba5c46a884
commit 19900bac81
4 changed files with 6 additions and 3 deletions

View file

@ -7,7 +7,8 @@
function Invoke-WindowsInstallation([Context] $context) function Invoke-WindowsInstallation([Context] $context)
{ {
$ErrorActionPreference = "Inquire"; $Global:InformationPreference = "Continue";
$Global:ErrorActionPreference = "Inquire";
. "$PSScriptRoot/../Scripts/Prerequisites.ps1"; . "$PSScriptRoot/../Scripts/Prerequisites.ps1";
$context.UserNames ??= @("Manuel"); $context.UserNames ??= @("Manuel");
Start-WindowsInstallation $context; Start-WindowsInstallation $context;

View file

@ -7,6 +7,8 @@
function Backup-WindowsInstallation([Context] $context) { function Backup-WindowsInstallation([Context] $context) {
Write-Information "Backing up Windows"; Write-Information "Backing up Windows";
$Global:InformationPreference = "Continue";
$Global:ErrorActionPreference = "Inquire";
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Prerequisites.ps1"; . "$PSScriptRoot/../../../scripts/Windows/Scripts/Prerequisites.ps1";
$backupRoot = $context.BackupRoot(); $backupRoot = $context.BackupRoot();
Backup-PersonalFiles $context; Backup-PersonalFiles $context;

View file

@ -1,4 +1,6 @@
#!/bin/pwsh #!/bin/pwsh
$Global:InformationPreference = "Continue";
$Global:ErrorActionPreference = "Inquire";
$null = $env:WIN_COMPUTER_NAME; $null = $env:WIN_COMPUTER_NAME;
$null = $env:SETUP_SCRIPT_NAME; $null = $env:SETUP_SCRIPT_NAME;

View file

@ -1,7 +1,5 @@
#!/bin/pwsh #!/bin/pwsh
. "$PSScriptRoot/Context.ps1"; . "$PSScriptRoot/Context.ps1";
$Global:InformationPreference = "Continue";
$Global:ErrorActionPreference = "Inquire";
[Context]::new().PreventSleepMode(); [Context]::new().PreventSleepMode();
$null = powershell -c Get-PackageProvider -ListAvailable NuGet; $null = powershell -c Get-PackageProvider -ListAvailable NuGet;