PowerShell Use Windows Event log log _powershell

Source: Internet
Author: User
Tags log log

Typically, people use file-based logs. There is no problem with this, but it is easier to use Windows to provide system internal logs.

If you have administrative privileges, you can create a new log at any time:

Copy Code code as follows:
New-eventlog-logname Mylog-source Jobdue, Jobdone, remark

This command creates a log called MyLog, which originates from "Jobdue", "Jobdone" and "remark". Admin permissions are just to create the log, the rest of the operation can be operated by other users. You can now add a new record to your log.

Copy Code code as follows:
Write-eventlog-logname mylog-source jobdue-entrytype Information-eventid 1-message ' This could to be a job description. '
Write-eventlog-logname mylog-source jobdue-entrytype Information-eventid 1-message ' This could to another job Descrip tion. '

In addition Get-eventlog, you can easily use it to analyze your log and query log information:
Copy Code code as follows:
Get-eventlog-logname Mylog-source Jobdue-after 2014-05-10

And Limit-eventlog, which allows you to adjust the maximum size of your log.

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.