From 8cae002d2d9f8cae92ce7b0d1a64827609573f33 Mon Sep 17 00:00:00 2001 From: romanitho <96626929+Romanitho@users.noreply.github.com> Date: Fri, 20 Oct 2023 16:27:29 +0200 Subject: [PATCH] Clean log header on log rotation --- .../functions/Invoke-LogRotation.ps1 | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/Winget-AutoUpdate/functions/Invoke-LogRotation.ps1 b/Winget-AutoUpdate/functions/Invoke-LogRotation.ps1 index 82edf17..ebc4644 100644 --- a/Winget-AutoUpdate/functions/Invoke-LogRotation.ps1 +++ b/Winget-AutoUpdate/functions/Invoke-LogRotation.ps1 @@ -71,19 +71,8 @@ function Invoke-LogRotation ($LogFile, $MaxLogFiles, $MaxLogSize) { } #Log Header - $Log = "##################################################`n# CHECK FOR APP UPDATES - $(Get-Date -Format (Get-culture).DateTimeFormat.ShortDatePattern)`n##################################################" - $Log | out-file -filepath $LogFile -Append - Write-ToLog "Running in System context" - if ($ActivateGPOManagement) { - Write-ToLog "Activated WAU GPO Management detected, comparing..." - if ($null -ne $ChangedSettings -and $ChangedSettings -ne 0) { - Write-ToLog "Changed settings detected and applied" "Yellow" - } - else { - Write-ToLog "No Changed settings detected" "Yellow" - } - } - Write-ToLog "Max Log Size reached: $MaxLogSize bytes - Rotated Logs" + Write-ToLog -LogMsg "CHECK FOR APP UPDATES (System context)" -IsHeader + Write-ToLog -LogMsg "Max Log Size reached: $MaxLogSize bytes - Rotated Logs" Return $True }