Skip to content
Snippets Groups Projects
Commit 407b6ff1 authored by Niko Ehrenfeuchter's avatar Niko Ehrenfeuchter :keyboard:
Browse files

Try to create EventLog source if not existing.

parent 95e2ca49
No related branches found
No related tags found
No related merge requests found
......@@ -386,6 +386,16 @@ catch {
Exit
}
if (-Not ([System.Diagnostics.EventLog]::SourceExists($ServiceName))) {
try {
New-EventLog -LogName Application -Source $ServiceName
}
catch {
$ex = $_.Exception.Message
Write-Verbose "Error creating event log source: $($ex)"
}
}
# NOTE: $MyInvocation is not available when run as ScheduledJob, so we have to
# set a shortcut for our name explicitly ourselves here:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment