From 2520b18ebe2cb90f7f0e7462cff599fa9d9ad96d Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Fri, 4 Sep 2026 13:11:01 +0200 Subject: [PATCH] Fix Print? --- WindowsMaintenanceReport.ps1 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/WindowsMaintenanceReport.ps1 b/WindowsMaintenanceReport.ps1 index 5e8110d..eedb911 100644 --- a/WindowsMaintenanceReport.ps1 +++ b/WindowsMaintenanceReport.ps1 @@ -114,11 +114,17 @@ function Write-Section { Write-Both $Writer $separator try { - & $Script 2>&1 | ForEach-Object { - $text = ($_ | Out-String -Width 240).TrimEnd() + $result = & $Script 2>&1 + $text = $result | Out-String -Width 240 - if (-not [string]::IsNullOrWhiteSpace($text)) { - Write-Both $Writer $text + if ([string]::IsNullOrWhiteSpace($text)) { + Write-Both $Writer '(no output)' + } + else { + $lines = $text.TrimEnd() -split "`r?`n" + + foreach ($line in $lines) { + Write-Both $Writer $line } } } @@ -126,7 +132,6 @@ function Write-Section { Write-Both $Writer ('ERROR: ' + $_.Exception.Message) } } - function Get-InstalledPrograms { $paths = @( 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*',