Skip to content

Instantly share code, notes, and snippets.

@azechi
Created December 31, 2016 01:04
Show Gist options
  • Save azechi/248a0d467d61b283002c5eba4d361ef4 to your computer and use it in GitHub Desktop.
Save azechi/248a0d467d61b283002c5eba4d361ef4 to your computer and use it in GitHub Desktop.
PowerShell
$source = "なまえ"
if([System.Diagnostics.Eventlog]::SourceExists($source) -eq $false)
{
New-Eventlog -Logname Application -Source $source
}
Write-Eventlog -LogName Application -Source $source -EntryType Error -EventId 1 -Message "message"
$ErrorActionPreference = "stop"
trap
{
# $error[0]
Exit(1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment