This blog is about Java (advanced Java topics like Reflection, Byte Code transformation, Code Generation), Maven, Web technologies, Raspberry Pi and IT in general.

Sonntag, 17. Januar 2016

How to get the boot time of a Windows 7 or Windows 10 system with Powershell

I must admit that i have a quite bad memory. Most of the time I can't remember when I arrived at work. But there is a quite easy way to figure it out, if the first thing you do is to turn on the computer. With this little Powershell command you see the time of the first system event. Because if you turn on the computer and login will generate system events this method is quite accurate.

> Get-EventLog System -After (Get-Date -F 'yyyy-MM-dd') | select -Last 1 | % {$_.TimeGenerated.ToString("HH:mm")}

3 Kommentare:

  1. Dieser Kommentar wurde vom Autor entfernt.

    AntwortenLöschen
  2. Clever trick! But powershell?! eww :)

    AntwortenLöschen
    Antworten
    1. If you are using Windows then Powershell is a valid option. I ignored it for a very long time because I love Cygwin and I am happy with it.

      Nevertheless Powershell is very powerful and has very many features. Lately I used the JSON parsing and the XPath integration of the Powershell.

      Löschen