Working with event logs
Detailed messages about informational events, warnings, and errors are logged in both the Windows event logs, and the Applications and Services event logs. These messages provide deep insight into what is going on with the operating system and your Exchange servers. In this recipe, you'll learn how PowerShell makes it easier than ever to monitor these logs using simple commands that can be used to troubleshoot issues and generate reports.
How to do it...
To determine the available Windows logs that you can work with on a server, use the
Get-EventLog
cmdlet with the-List
parameter:The names listed under the Log column are the log names you can use with the
Get-EventLog
cmdlet. For example, to view the events in the application log that were logged by Exchange, you could use the following command:Get-EventLog -LogName Application -Source *exch* -EntryType Error
In addition to specifying the log name and the entry type, you can retrieve a specific number of log entries...