Function Get-EventData { params( [string]$LogName, [string]$ProviderName, [datetime]$SearchFromTime ) # Store search position of event logs in the Windows Registry # This should eliminate the possibility of double-reporting the same event $BaseKey = 'HKLM:\SOFTWARE\ATERA Networks\Get-EventData' $AllLogs = (Get-WinEvent -ListLog *) $LogsWithEvents = ($AllLogs | Where-Object { $_.RecordCount -gt 0 }) ForEach ( $logWithEvents in $LogsWithEvents ) { } }