How to List Windows Power On and Power Off Events with PowerShell? (Example)


Windows is an operating system that literally everyone knows about. It ranks among the best in the world for its great features and easy-to-use interface. However, there are still mysteries that not everyone knows and that is why Today you will learn how to list Windows on and off events with PowerShell.

More than mysteries, it should be said that it is ignorance that prevents people from using Windows command systems, this because most believe that they are very complicated or that they are unnecessary. Both are very far from reality and that is why this tutorial was created.

List Windows Power On and Off Events with PowerShell

You must take into account before starting this tour that there is not only one way to see the on and off of a computer. But there are many, so today you will see the most important and better, starting of course with the title.

You may also be interested in:

Now, what you should do to list Windows on and off events with PowerShell, is to first go to the powershell application and open it.

Then, you must enter and run the following cmld: Get-Eventlog -LogName System -InstanceId 12 | Select TimeGeneratedThis will allow you to see all the power-on events that have occurred on your PC, with the exact date and time of when each of them occurred.

gray powershell icon

Besides this you can also use this other cmdl: (get-date) – (gcim Win32_OperatingSystem) .LastBootUpTime, to obtain more detailed information, such as: the days, seconds, minutes, microseconds and hours that the computer has been turned on. In the event that you also want to see the shutdowns that the computer has had, you will need to use another program called Windows Viewer.

The Windows viewer

With the previous commands you were able to answer the first part of the question How to list Windows on and off events with PowerShell? But in order to complete it, it is necessary to use another much more efficient program, which allows the detailed visualization of each event that has occurred on the computer (since as you have read the previous one it does not tell you the shutdown).

To enter this program called Windows Event Viewer, you must first hit the key combination control + R. This will open the “Run”, Where you should put the code eventvwr.

Then, once you are inside you have to walk through the left panel going through the folders «Windows logs» Y «System”Respectively. This way you will get to the system events, which will be located in the central panel.

In this section you will be able to see when the equipment was turned on, suspended and turned off (all will be ordered by exact date and time). You can also filter the search by giving the option «Filter record» found on the right side panel.

power button

When you click it, a window will appear where you must enter the ID of the event you are looking for in the corresponding boxes. Once set, confirm and go (this will save you time if you are looking for something specific).

With that last, the doubt should have been more than cleared How to list Windows on and off events with PowerShell? you just have to put both programs into practice (which come native, so there is no need to download anything) and you will have your answers.

Use the CMD console

Now that you know the above, as a little extra piece of information, you will also see a command from the CMD console. This, despite not being as specific as the two others, will let you know the time and day the computer was turned on.

This is: systeminfo | find «System boot time», once you place it you will only have to give it intro to execute it and that’s it.

Finally, remember that Powershell is used for many more things than just checking the on and off, so it is necessary that you look for more information about it if you want to use it completely. It is recommended that you start looking for things like how to see programs installed on local or remote computer? How to show hidden files with Get-Childitem-Hidden-File? And how to rename a computer with rename-Computer? Because with this knowledge you will learn the main commands of the program.

Source by

How useful did you find this content?

Click on a star to rate!

Average score 0 / 5. Counting of votes: 0

So far, no votes. Be the first to rate this content.

I'm sorry this content was not useful for you!

Let me improve this content!

Tell me, how can I improve this content?

You may also be interested in:

Deja un comentario