Refactor log levels

This commit is contained in:
Manuel Thalmann 2023-06-22 17:32:36 +02:00
parent c78524ef69
commit 5f494526f0
3 changed files with 9 additions and 9 deletions

View file

@ -2,7 +2,7 @@
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1";
$null = New-Module {
Write-Information "Starting Restoration of Windows";
Write-Host "Starting Restoration of Windows";
. "$PSScriptRoot/../../../scripts/Windows/OS/Install.ps1";
[Context]$context = [Context]::new();
$context.EntryPoint = "$($MyInvocation.MyCommand.Path)";

View file

@ -3,7 +3,7 @@
function Invoke-WindowsInstallation([Context] $context)
{
Write-Information "Starting Installation and Restoration of Windows";
Write-Host "Starting Installation and Restoration of Windows";
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Prerequisites.ps1";
Invoke-Upgrade $context;
Invoke-WindowsRestore $context;

View file

@ -1,29 +1,29 @@
function Invoke-Upgrade([Context] $context)
{
Write-Information "Upgrading Windows";
Write-Information "Preparing for Windows Update";
Write-Host "Upgrading Windows";
Write-Host "Preparing for Windows Update";
$null = Import-Module PSWindowsUpdate;
Write-Information "Performing Windows Update";
Write-Host "Performing Windows Update";
$null = Install-WindowsUpdate -AcceptAll -IgnoreReboot;
if ((Get-WURebootStatus -Silent))
{
Write-Debug "A Reboot is Required!";
Write-Debug "Windows will reboot now and the installation will be continued automatically.";
Write-Information "A Reboot is Required!";
Write-Information "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;
Restart-Computer;
exit;
}
elseif ((Get-WindowsUpdate).Count -gt 0)
{
Write-Debug "More updates are available. Restarting upgrade routine.";
Write-Information "More updates are available. Restarting upgrade routine.";
$null = Invoke-Upgrade $context;
return;
}
else
{
Write-Host "Upgrading Windows finished successfully!";
Write-Information "Upgrading Windows finished successfully!";
return;
}
}