Reviews and improvements, part 4

This commit is contained in:
Patrick Asmus
2026-07-06 10:21:05 +02:00
parent f4d7995165
commit 0fe6d8ad7b
2 changed files with 20 additions and 8 deletions

View File

@@ -9,9 +9,9 @@ Author: Patrick Asmus
Web: https://www.cleveradmin.de
Repository: https://git.techniverse.net/scriptos/windows-updater.git
License: MIT
Version: 2.5.0
Version: 2.6.0
Date: 06.07.2026
Modifications: Reviews and improvements, part 3
Modifications: Reviews and improvements, part 4
#####################################################
#>
@@ -455,9 +455,14 @@ function Send-EmailNotification {
$mailParams["Credential"] = $cred
}
if ($htmlReport -and $UpdateResults.Count -gt 0) {
$htmlBody = New-HtmlUpdateReport -Results $UpdateResults -Hostname $env:COMPUTERNAME -OSCaption $script:OSInfo.Caption
$mailParams["Body"] = $htmlBody
if ($IsHtml -or ($htmlReport -and $UpdateResults.Count -gt 0)) {
if ($UpdateResults.Count -gt 0) {
$htmlBody = New-HtmlUpdateReport -Results $UpdateResults -Hostname $env:COMPUTERNAME -OSCaption $script:OSInfo.Caption
$mailParams["Body"] = $htmlBody
}
else {
$mailParams["Body"] = $Body
}
$mailParams["BodyAsHtml"] = $true
}
else {
@@ -914,7 +919,9 @@ function Invoke-WingetUpgrade {
}
}
}
catch {}
catch {
Write-Log "Appx-based winget detection failed: $($_.Exception.Message)" -Level WARN
}
}
if (-not $wingetCmd) {
@@ -960,7 +967,9 @@ function Test-PendingReboot {
$wuReboot = Get-WURebootStatus -Silent -ErrorAction SilentlyContinue
if ($wuReboot) { $rebootRequired = $true }
}
catch {}
catch {
Write-Log "WURebootStatus check failed: $($_.Exception.Message)" -Level WARN
}
$regPaths = @(
"HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending",
@@ -979,7 +988,9 @@ function Test-PendingReboot {
$rebootRequired = $true
}
}
catch {}
catch {
Write-Log "PendingFileRenameOperations check failed: $($_.Exception.Message)" -Level WARN
}
return $rebootRequired
}