Jul 2, 2026, 9:34 AM
This commit is contained in:
@@ -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 { }
|
||||
}
|
||||
|
||||
# ========================================================
|
||||
|
||||
Reference in New Issue
Block a user