How to list Windows power on and off events with PowerShell?

Who I am
Marie-Ange Demory

Author and references

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

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

    List Windows power on and off events with PowerShell

    It should be borne in mind before starting this tour that there is no single way to see a computer turning on and off. But there are many, then today you will see the most important is the best , obviously starting from the title.

    Now, what you need to do to list Windows activation and deactivation events with PowerShell, is first go to the PowerShell application and open it.

    Then, you need to enter and run the following cmld: Get-Eventlog -LogName System -InstanceId 12 | Seleziona TimeGenerated , this will allow you to see all the power up events that have occurred on your PC, with the exact date and time of when each one was.

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

    Read Why is my Windows laptop webcam flashing? - Solution

    The Windows Viewer

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

    To access this program called Windows Event Viewer, you must first press the key combination control + R . This will open the " Run ", where you have to enter the eventvwr code.

    So, once inside, you have to go through the left panel by going through the folders respectively " Windows Logs " and " System ". This will take you to the system events, which will be located in the central panel.

    In that section you will be able to see when the equipment was turned on, suspended and turned off (everything will be sorted by exact date and time). You can also filter your search by clicking on the option "Filter records" that you located in the right panel.

    When you click it, a window will appear where you will need to enter the ID of the event you are looking for in the corresponding boxes. Once set up, confirm and that's it (this will save you time if you're looking for something specific).

    With the latter, the question should have been more than clarified to list Windows on and off events with PowerShell? Just put both programs into practice (which come native, so you don't need to download anything) and you'll have your answers.

    Use the CMD console

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

    Read How to create a business email account in Yandex Mail? - Free and fast

    This is: systeminfo | finds " Time to system start " , once positioned you will only have to give it an introduction to run it and that's it.

    Finally, remember that Powershell is used for a lot more things besides controlling the power on and off, so you need to look for more information about it if you want to use it fully. Is it recommended that you start looking for things like seeing programs installed on a local or remote computer? , How to show hidden files with Get-Childitem-Hidden-File? and how to rename the equipment with rename-Computer? , because with this knowledge you will learn the main commands of the program.

    add a comment of How to list Windows power on and off events with PowerShell?
    Comment sent successfully! We will review it in the next few hours.