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

Perusing General Log Files

If you are only interested in glancing at the event logs for an overview of the types of errors, you can use the Get-EventLog cmdlet. This is shown in the GetNewestLogEntries.ps1 script. This script relies upon using the -newest argument to retrieve only a specific number of event log entries.

Tip

When passing more than one argument to a cmdlet, I prefer to specify the name of all parameters. Technically, you can use the default parameter without using its parameter name, but then you still must specify the optional parameters. It can become confusing, so I just do the following: type a hyphen, press Tab, press Enter, type another hyphen, and press Tab once again and I am finished. This does not require much more time ...

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