-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Get-WinEvent with Hashtable instead of Get-Eventlog increases performance #47
Labels
Enhancement
New feature or request
Comments
Looks like it throws an error when the event log is clean, so we will need to handle that gracefully.
|
That is true, but I experience the same when the eventlog is clean using the Get-Eventlog CMDlet |
Ah you're right, we just need to tack on the SilentlyContinue like the other command had. |
bill-long
added a commit
that referenced
this issue
Mar 4, 2021
Thank you! |
Right, forgot to take parameter "-ErrorAction SilentlyContinue" into my command |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CSS-Exchange/Security/Test-Hafnium.ps1
Line 45 in 2fce810
I replaced line 45 where the eventlog is searched using CMDlet "Get-Eventlog" with CMDlet "Get-WinEvent" using FilterableHashtable as follows:
$eventLogs = Get-WinEvent -FilterHashtable @{LogName='Application'; ProviderName='MSExchange Unified Messaging'; Level='2'} | Where-Object { $_.Message -like "
*
System.InvalidCastException*
"}This speeds up the query approx by factor 10 on my systems. Eventlog search now only takes about 3 minutes per system instead of 30 minutes
The text was updated successfully, but these errors were encountered: