SQL Server Installation Date

I have been working on a project recently to collect system metrics of a SQL Server environment. One of the items that came up that would like to collected is the date that SQL Server was installed on the server.  In doing a quick search on where this property would be located I found that sys.server_principals would hold the key. 

The principal “NT AUTHORITY\SYSTEM” should always have a sid of ‘0x010100000000000512000000’ and its created_date would be when SQL Server was installed. 

Knowing this you can determine when SQL Server was installed using TSQL using the following script.

SELECT create_date
FROM sys.server_principals
WHERE sid = 0x010100000000000512000000

This works on SQL 2005 and above.

 

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *