Boot Time

Get Last Boot Time of a Server

When you want to determine the last time a system rebooted, it can be a real pain. You can remote to the server and check the sysinfo utility, or you can peruse the logs and make the determination. But if you just want to get the last boot time, you can use this little powershell command.

Get-WmiObject -ComputerName <SERVER> win32_OperatingSystem | select csname,@{LABEL='LastBootUpTime' ;EXPRESSION={$_.Conv

In the above, change the <SERVER> to the name of the server from which you want to obtain the last boot time.

One problem is that the lastbootuptime field is in wmi date format. Although you can read this format, it is generally an easier read if you use a standard date format. To do this we call the win32_operatingsystem objects converttodatetime function.

Additionally, if you want last boot times from multiple systems, you can separate the <SERVER> entries with a comma as in SERVER1,SERVER2.

Leave a Reply