Skip to content

Commit 7bea235

Browse files
committed
Better error handling
1 parent fca273b commit 7bea235

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Modules/Get-EventsLoginFailures.psm1

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ function Get-EventsLoginFailures {
2929
}
3030
3131
.NOTES
32-
Updated: 2023-08-18
32+
Updated: 2024-04-03
3333
3434
Contributing Authors:
3535
Anthony Phipps, Jack Smith
3636
37-
LEGAL: Copyright (C) 2023
37+
LEGAL: Copyright (C) 2024
3838
This program is free software: you can redistribute it and/or modify
3939
it under the terms of the GNU General Public License as published by
4040
the Free Software Foundation, either version 3 of the License, or
@@ -81,7 +81,7 @@ function Get-EventsLoginFailures {
8181

8282
process{
8383

84-
$ResultsArray = Get-WinEvent -FilterHashtable @{ LogName="Security"; ID=4625; StartTime=$StartTime; EndTime=$EndTime } -ErrorAction SilentlyContinue
84+
$ResultsArray = Get-WinEvent -FilterHashtable @{ LogName="Security"; ID=4625; StartTime=$StartTime; EndTime=$EndTime } -ErrorAction Ignore
8585

8686
foreach ($Result in $ResultsArray) {
8787
$Result | Add-Member -MemberType NoteProperty -Name "UserSID" -Value ($Result.Properties[4].Value)

0 commit comments

Comments
 (0)