Manage the Event Log with the command line
In the following article, we will show you some of the functions in Windows 7 Desktop that can be done and controlled easily by the command line.
Manage Event Log:
First, open the Command Prompt ( Start> Run> type cmd and press Enter ) and find out about the utility WEVTUTIL.EXE
Windows Events Command Line Utility.Enables you to retrieve information about event logs and publishers, install
and uninstall events manifests, run queries, and export, archive, and clear logs.Usage:Bạn có thể sử dụng như dưới (cho example, ep / uni) or long (for example,
enum-publishers / unicode) version of the command and options names. Commands,
các tùy chọn và tùy chọn tùy chọn không có tùy chọn-sensitive.
.
The initial default feature of this statement is to query directly to the log files on the local computer, if you want to apply it to the remote computer - the remote control, then add the / r parameter. However, we can only execute this query on a single computer at a time only. The basic syntax of WEVTUTIL is in the form of:C:> wevtutil qeThe following table are frequently used parameters:When you connect to the remote computer, the system will use the identity information of the current account, but if you want to change, you use the syntax as below:/ u: domainusername and / p:When pairing this information together, suppose that you want to gather information about the 5 components in the System Event Log on the computer CHI-FP01:C:> wevtutil qe System / c: 5 / r: chi-fp01 / u: globomanticsadministrator / p: * / f: text / rd: trueIn fact, we should not type the password as text here, but rather use the * character as shown below:However, it is not easy to find and understand the component information in the log file log, because Windows Event Log requires users to have knowledge of XML. If you want a specific record, you need to use the / q parameter, which requires an XPath. For experienced users it is recommended to use the syntax form as follows:"/ q: * [[( xmlvalue=value> )]] "The XML value section here is the XML node name, select that component to check:
Assuming that we want to execute a query to EventID 7036 , we will use the following command:C:> wevtutil qe System / q: "* [System [(EventID = 7036)]]" / c: 5 / r: chi-fp01 / f: text / rd: trueAnd the results show up at this step:In addition, another frequently used function here is to collect information about components and related information, such as Error or Warning . We can do it, but it must be based on the corresponding Level :Level Description Level 1CriticalLevel 2ErrorLevel 3WarningLevel 4InformationTherefore, to get information about the 5 most recent errors in the System Event Log of CHI-DC01 , type the command:C:> wevtutil qe system "/ q: * [System [(Level = 2)]]" / f: text / c: 5 / rd: True / r: chi-dc01 | moreOr switch to text format with the conversion command:C:> wevtutil qe system "/ q: * [System [(Level = 2)]]" / f: text / c: 5 / rd: True / r: chi-dc01> d: dc01-system-err.txtOr make the order more complicated:C:> wevtutil qe system "/ q: * [System [(Level = 2 or Level = 3)]]" / f: text / c: 5 / rd: True / r: chi-dc01 | moreBut you need to be careful, because uppercase and lowercase letters here must be absolutely accurate.
Advanced Query command with Event Viewer Management Console:
For complex query statements, we should open the Event Viewer Management function and use the graphical interface to create the query. Then, look at the XML file and save the necessary piece of information into the Command Line . For frequently used components, you should save it as a text file, then enter it into the query. Examples are as follows:Copy and save the above code into a text file, then we can use the query with the Command Line:C:> wevtutil qe s: scmquery.txt / sq: true / c: 5 / f: text / r: chi-fp01Instead of the log file name, we explicitly specify the path to the XML query statement and set the parameter / sq to True . If there are no matching events, the system will not return any suitable data. In the next section of the article, we will discuss more about how to manage the Event Log . Good luck!
You should read it
May be interested
- Instructions for managing programs in Ubuntu via the command lineas we all know, ubuntu has a lot of tools to support graphic delivery to install software and applications inside the system, but users have to search. however, for those who love and have spent a lot of time using this open source operating system, the process of handling and manipulating the command line simply through the keyboard will be much faster and save time. .
- 10 tips for using Command Line Windows 10 users should knowyou can use the cmd command to perform some tasks that normally only use mouse, drag and click. the cmd command is also quite useful when you need to create scripts and automated tasks.
- How to Manage Users in Linuxunlike windows, as a unix-like system, linux was conceived of as a multi-user system from its inception. the following sections deal with user management through the linux command line. type adduser -d /home/users/ into the command line.
- 12 best command line emulators for Windowsnowadays, users can get a shell inside windows 10, but many still prefer configurable command line emulators. therefore, this article will introduce to you five of the best command line emulator software for windows 10.
- 12 things Linux is easier to do in the command line than graphical softwaregraphical user interfaces (guis) were invented to make life easier for computer users, so it's very common to use them to perform most everyday tasks.
- How to copy (and paste) files and folders from the Linux command linecopying and pasting files is one of the most basic things you can do on your computer. on linux, you have several options to accomplish this.
- How to use Command Prompt, how to use cmd on Windowshidden deep within windows is a command line world that few people know about. in this article, we will show you how to resolve errors and make your computer more secure using the cmd command line tool.
- How to manage packages in openSUSE with Zypperwith zypper, you can perform several functions from package installation to uninstallation using the command line. here's how you can use zypper and its command line options to manage packages in opensuse.
- The basics of Cisco Switch Management - Part 1in the command-line interface cli (command-line interface) you can perform any type of configuration. so you can use the ios command line interface.
- How to Open a Command Line Program on Windowstipsmake today will show you how to open the command prompt command line window on windows pc. you can open command prompt from the start menu or any folder in file explorer. besides, the windows run feature is also an option.