Grouping event logs:
Get-EventLog -Logname application -Entrytype error | sort source | group source
Grouping event logs in Descending order:
Get-EventLog -Logname application -Entrytype error | sort source |group source | sort count -Descending
Running a faster script:
Get-EventLog -LogName application | where { $_.timegenerated -gt [datetime]“7/01/14″ }
This command took 11 seconds to complete (It lists all application log events in the last 20 days e.g. today date being 07/20/2014
Get-EventLog -LogName application -after 7/01/14
This command took 8 seconds to complete e (It lists all application log events in the last 20 days e.g. today date being 07/20/2014
So, the above two commands accomplish the same task but, the latter took 3 seconds less because the filtering was done on the left side of the pipeline, or without a need of a pipeline operator
So try filtering to the left if possible
Measuring the time it tales to run a command:
Measure-command { Get-EventLog -LogName application -after 7/01/14 }
So, it took 3696 miliseconds or approximately 4 seconds to execute the command
