SQL SERVER – Script: Find Last System / Operating System Reboot or Restart Time

Sometimes we need to find last reboot time of the server via some script. In this blog, I am sharing the script to find the last system reboot time.

I have written blog earlier to find last restart time of SQL Server. When Was SQL Server Last Restarted? – Interview Question of the Week #225

But it’s not necessary that the operating system was restarted at the same time. So there might be a need to find the operating system start time.

Reboot Time

We can use below command line to get more information about the system. The command is called as system info which can show lots of information about the system.

systeminfo | find "System Boot Time"

Here is the output of the command:

SQL SERVER - Script: Find Last System / Operating System Reboot or Restart Time reboottime-350x350

This method only shows the last boot time. If you want information about older reboots, then the System Event Log is the only place I am aware of.

systeminfo command displays detailed configuration information about a computer and its operating system, including operating system configuration, security information, product ID, and hardware properties.

Do you have any other tiny useful script?

Here are a couple of interesting questions which I have recently written.

Which is Optimal – TOP 0 OR WHERE 1 = 2? – Interview Question of the Week #190

Question: Which is Optimal – TOP 0 OR WHERE 1 = 2?

Answer: They both are the same!

When to Use sort_in_tempdb for Rebuilding Indexes? – Interview Question of the Week #207

Question: When to Use sort_in_tempdb for Rebuilding Indexes?

Answer: This question was received during one of the recent Comprehensive Database Performance Health Check consulting engagement. One of the last thing which we did during the consulting was to set up the rebuilding indexes job. While we set this one up, one of the DBA asked this question.

How to Shrink All the Log Files for SQL Server? – Interview Question of the Week #203

Question: How to Shrink All the Log Files for SQL Server?

Answer: This question was asked recently after reading my latest blog post here: SQL SERVER – Small Backup for Large Database. Before you continue reading this blog post, let me stress on a couple of details. First of all – I am no way encouraging you to shrink your database and particularly data files. Shrinking the database can be very very bad for your SQL Server’s Performance and it can be extremely costly to you eventually.

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL Command, SQL Scripts, SQL Server, Starting SQL
Previous Post
SQL SERVER – Detecting Database Isolation Level MEMORY_OPTIMIZED_ ELEVATE_TO_SNAPSHOT
Next Post
SQL SERVER – Memory Optimized Tables, Transactions, Isolation Level and Error

Related Posts

Leave a Reply