From f39076dbff04d63b09598bab89cfefef50cf52df Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 22 Jun 2023 17:18:50 +0200 Subject: [PATCH] Add log messages --- profiles/DerGeret/Windows/Restore.ps1 | 1 + scripts/Windows/OS/Install.ps1 | 1 + scripts/Windows/OS/Upgrade.ps1 | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/profiles/DerGeret/Windows/Restore.ps1 b/profiles/DerGeret/Windows/Restore.ps1 index f38361d7..ebaf87d6 100644 --- a/profiles/DerGeret/Windows/Restore.ps1 +++ b/profiles/DerGeret/Windows/Restore.ps1 @@ -2,6 +2,7 @@ . "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1"; $null = New-Module { + Write-Information "Starting Restoration of Windows"; . "$PSScriptRoot/../../../scripts/Windows/OS/Install.ps1"; [Context]$context = [Context]::new(); $context.EntryPoint = "$($MyInvocation.MyCommand.Path)"; diff --git a/scripts/Windows/OS/Install.ps1 b/scripts/Windows/OS/Install.ps1 index 85cbb013..9f78de23 100644 --- a/scripts/Windows/OS/Install.ps1 +++ b/scripts/Windows/OS/Install.ps1 @@ -3,6 +3,7 @@ function Invoke-WindowsInstallation([Context] $context) { + Write-Information "Starting Installation and Restoration of Windows"; . "$PSScriptRoot/../Scripts/Prerequisites.ps1"; Invoke-Upgrade $context; Invoke-WindowsRestore $context; diff --git a/scripts/Windows/OS/Upgrade.ps1 b/scripts/Windows/OS/Upgrade.ps1 index cdfae50c..cc19a2a9 100644 --- a/scripts/Windows/OS/Upgrade.ps1 +++ b/scripts/Windows/OS/Upgrade.ps1 @@ -1,20 +1,28 @@ function Invoke-Upgrade([Context] $context) { + Write-Information "Upgrading Windows"; + Write-Information "Preparing for Windows Update"; $null = Import-Module PSWindowsUpdate; + + Write-Information "Performing Windows Update"; $null = Install-WindowsUpdate -AcceptAll -IgnoreReboot; if ((Get-WURebootStatus).RebootRequired) { + Write-Debug "A Reboot is Required!"; + Write-Debug "Windows will reboot now and the installation will be continued automatically."; $null = New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\RunOnce" -Name "PortValhalla" -Value "pwsh `"$($context.EntryPoint)`"" -PropertyType ExpandString; exit; } elseif ((Get-WindowsUpdate).Count -gt 0) { + Write-Debug "More updates are available. Restarting upgrade routine."; $null = Invoke-Upgrade $context; return; } else { + Write-Host "Upgrading Windows finished successfully!"; return; } }