From 9a57a3b3cc915db185027dd34e4e2f8ce67a2eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Doma=C5=84ski?= Date: Thu, 2 Jul 2026 07:34:09 +0000 Subject: [PATCH] Jul 2, 2026, 9:34 AM --- toolbox/s3_backup_transfer.ps1 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/toolbox/s3_backup_transfer.ps1 b/toolbox/s3_backup_transfer.ps1 index b33a742..107449d 100644 --- a/toolbox/s3_backup_transfer.ps1 +++ b/toolbox/s3_backup_transfer.ps1 @@ -79,10 +79,15 @@ if ($FolderName -eq "all") { function Write-AppEventLog { param([string]$Type, [int]$Id, [string]$Message) $EventSource = "SQLBackupToS3" - if (-not [System.Diagnostics.EventLog]::SourceExists($EventSource)) { - try { New-EventLog -LogName Application -Source $EventSource } catch { } + try { + if (-not [System.Diagnostics.EventLog]::SourceExists($EventSource)) { + New-EventLog -LogName Application -Source $EventSource + } + Write-EventLog -LogName Application -Source $EventSource -EntryType $Type -EventId $Id -Message $Message + } catch { + # Ignorujemy błędy EventLog (np. brak uprawnień administratora) + # Informacja i tak została już wypisana na ekran przez Write-Host } - try { Write-EventLog -LogName Application -Source $EventSource -EntryType $Type -EventId $Id -Message $Message } catch { } } # ========================================================