Refactor log levels
This commit is contained in:
parent
b4d6b651b6
commit
9180ca96ef
3 changed files with 9 additions and 9 deletions
|
@ -2,7 +2,7 @@
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1";
|
. "$PSScriptRoot/../../../scripts/Windows/Scripts/Context.ps1";
|
||||||
|
|
||||||
$null = New-Module {
|
$null = New-Module {
|
||||||
Write-Information "Starting Restoration of Windows";
|
Write-Host "Starting Restoration of Windows";
|
||||||
. "$PSScriptRoot/../../../scripts/Windows/OS/Install.ps1";
|
. "$PSScriptRoot/../../../scripts/Windows/OS/Install.ps1";
|
||||||
[Context]$context = [Context]::new();
|
[Context]$context = [Context]::new();
|
||||||
$context.EntryPoint = "$($MyInvocation.MyCommand.Path)";
|
$context.EntryPoint = "$($MyInvocation.MyCommand.Path)";
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
function Invoke-WindowsInstallation([Context] $context)
|
function Invoke-WindowsInstallation([Context] $context)
|
||||||
{
|
{
|
||||||
Write-Information "Starting Installation and Restoration of Windows";
|
Write-Host "Starting Installation and Restoration of Windows";
|
||||||
. "$PSScriptRoot/../Scripts/Prerequisites.ps1";
|
. "$PSScriptRoot/../Scripts/Prerequisites.ps1";
|
||||||
Invoke-Upgrade $context;
|
Invoke-Upgrade $context;
|
||||||
Invoke-WindowsRestore $context;
|
Invoke-WindowsRestore $context;
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
function Invoke-Upgrade([Context] $context)
|
function Invoke-Upgrade([Context] $context)
|
||||||
{
|
{
|
||||||
Write-Information "Upgrading Windows";
|
Write-Host "Upgrading Windows";
|
||||||
Write-Information "Preparing for Windows Update";
|
Write-Host "Preparing for Windows Update";
|
||||||
$null = Import-Module PSWindowsUpdate;
|
$null = Import-Module PSWindowsUpdate;
|
||||||
|
|
||||||
Write-Information "Performing Windows Update";
|
Write-Host "Performing Windows Update";
|
||||||
$null = Install-WindowsUpdate -AcceptAll -IgnoreReboot;
|
$null = Install-WindowsUpdate -AcceptAll -IgnoreReboot;
|
||||||
|
|
||||||
if ((Get-WURebootStatus -Silent))
|
if ((Get-WURebootStatus -Silent))
|
||||||
{
|
{
|
||||||
Write-Debug "A Reboot is Required!";
|
Write-Information "A Reboot is Required!";
|
||||||
Write-Debug "Windows will reboot now and the installation will be continued automatically.";
|
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;
|
$null = New-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\RunOnce" -Name "PortValhalla" -Value "pwsh `"$($context.EntryPoint)`"" -PropertyType ExpandString;
|
||||||
Restart-Computer;
|
Restart-Computer;
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
elseif ((Get-WindowsUpdate).Count -gt 0)
|
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;
|
$null = Invoke-Upgrade $context;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Write-Host "Upgrading Windows finished successfully!";
|
Write-Information "Upgrading Windows finished successfully!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue