Created
December 31, 2016 01:04
-
-
Save azechi/248a0d467d61b283002c5eba4d361ef4 to your computer and use it in GitHub Desktop.
PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $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