|
$eventLogs = Get-EventLog -LogName Application -Source "MSExchange Unified Messaging" -EntryType Error -ErrorAction SilentlyContinue | Where-Object { $_.Message -like "*System.InvalidCastException*" } |
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
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