O'Reilly logo

Windows PowerShell™ Scripting Guide by Ed Wilson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reading the Event Logs

Once you have used Get-EventLog -list to identify the event logs that are installed on your computer, you can now use Get-EventLog to read the event logs. In the most basic form, you simply feed the name of the event log to the Get-EventLog cmdlet. This is shown in the following GetApplicationEventLog.ps1 script.

Example 3-2. GetApplicationEventLog.ps1

Get-EventLog application

When you run the command, the entire contents of the event log are dumped to the screen. The GetApplicationEventLog.ps1 script is a single line. Saving it as a script makes it easy to remember this command, and you can always add more commands to the script later. If we were to run the command that is contained in the script from the Windows PowerShell ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required