diff --git a/doc/31-Changelog.md b/doc/31-Changelog.md index 2d9591d8..ce7927d7 100644 --- a/doc/31-Changelog.md +++ b/doc/31-Changelog.md @@ -37,6 +37,7 @@ This release adds the following new plugins: * [#36](https://github.com/Icinga/icinga-powershell-plugins/issues/36) Fixes Ok return value for Invoke-IcingaCheckDirectory while -Path argument is not set * [#37](https://github.com/Icinga/icinga-powershell-plugins/issues/37) Fixes `-FileNames` argument being ignored for Invoke-IcingaCheckDirectory while not using the `-Recurse` argument * [#40](https://github.com/Icinga/icinga-powershell-plugins/issues/40) Fixes `Get-TimeZone` Cmdlet not known for `Invoke-IcingaCheckTimeSync` on Windows 2012 R2 and older +* [#50](https://github.com/Icinga/icinga-powershell-plugins/issues/50), [#51](https://github.com/Icinga/icinga-powershell-plugins/issues/51) Fixes possible crash/artifacts on plugin output for EventLog check while filters do not match any entry ## 1.1.0 (2020-06-02) diff --git a/provider/eventlog/Get-IcingaEventLog.psm1 b/provider/eventlog/Get-IcingaEventLog.psm1 index 164185ba..ba92f501 100644 --- a/provider/eventlog/Get-IcingaEventLog.psm1 +++ b/provider/eventlog/Get-IcingaEventLog.psm1 @@ -54,11 +54,10 @@ function Get-IcingaEventLog() } try { - $events = Get-EventLog @EventLogArguments; + $events = Get-EventLog @EventLogArguments -ErrorAction Stop; } catch { Exit-IcingaThrowException -InputString $_.Exception -StringPattern 'ParameterBindingValidationException' -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.EventLog; Exit-IcingaThrowException -InputString $_.Exception -StringPattern 'System.InvalidOperationException' -CustomMessage (-Join $LogName) -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.EventLogLogName; - Exit-IcingaThrowException -InputString $_.Exception -ExceptionType 'Unhandled' -Force; } if ($null -ne $ExcludeEventId -Or $null -ne $ExcludeUsername -Or $null -ne $ExcludeEntryType -Or $null -ne $ExcludeMessage -Or $null -ne $IncludeMessage) {