Jul 2, 2026, 9:34 AM

This commit is contained in:
Paweł Domański
2026-07-02 07:34:09 +00:00
parent 1c1037b6ab
commit 9a57a3b3cc
+7 -2
View File
@@ -79,10 +79,15 @@ if ($FolderName -eq "all") {
function Write-AppEventLog {
param([string]$Type, [int]$Id, [string]$Message)
$EventSource = "SQLBackupToS3"
try {
if (-not [System.Diagnostics.EventLog]::SourceExists($EventSource)) {
try { New-EventLog -LogName Application -Source $EventSource } catch { }
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 { }
}
# ========================================================