Windows Event Log Query case

Source: Internet
Author: User
Tags system log

1.querying the native event log name

get-eventlog-list                                 


2. Query 2018 year 1 month 4 Future error log in the system log

Get-eventlog-logname System-entrytype Error-after 2018-1-4


3. View Individual event log details ( The value of index is the ordinal of the event log )

Get-eventlog-logname System | Where-object {$_.index-eq 2677} | Select-object-property *

4. Query The log after the specified date and sort by index ordinal, filter the top 5 items, and customize the field to generate the table ( the first two behavior fields and separators )

get-eventlog-logname System -computername. -entrytype Error-after 2018-1-4 | Sort-object-descending Index | Select-object-first 7 | Format-table-property index,eventid,machinename,entrytype,source,timegenerated,username,message-autosize| Out-file C:\Log.csv


Note: Can be combined with out-file command to import into the CSV file for easy query (if the display width is not wide enough, be sure to take the parameter "-autosize" and the PowerShell execution form width to 5000 or more, the wider the better)



Windows Event Log Query case

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.