Uncategorized · February 8, 2021 0

Get the Last Boot Time

the easiest way is executing the code below on the machine after launching ISE window

SystemInfo | find /i "Boot Time"

the output will show the date and time the computer was last rebooted at

Notice that, you can run the code from a local machine to inquiry the last boot time of a remote machine, all what you need to modify is to define the computer name and use the /s as shown below

$computerName = "something"

SystemInfo /S $computerName | find /i "Boot Time"

what if that did

For some reason the above method does not bring any result (at leas it happend with me on windows server 2008 R2) and in that case I use the following workaround method

get-eventlog System | where-object {$_.EventID -eq "6005"} | sort -desc TimeGenerated
the above code searches and display the events that are generated when restarting the operating system. As seen below; the exact time is also displayed for each restart.

Thats it ; ) happy coding


Close Bitnami banner