Computer, how old are you?

Yesterday I wrote about finding old computers. Here’s how I determine how old a computer is.

There’s a registry key called HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate that stores the system build time in Unix format (the number of seconds since 1 January 1970) and hexadecimal. With a few mad skilz you can make that data human-readable.

First read the data by running this command at a command prompt:

reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v InstallDate

Here’s what the output looks like:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
InstallDate REG_DWORD 0x4e87c777

The data you want are the characters right after the “0x.” In my case, 4e87c777.

Paste that value into your favorite spreadsheet in cell A1.

In cell B1, enter this formula:

=hex2dec(A1)

In cell C1, enter this messy formula:

=B1/(60*60*24)+"1/1/1970"

Make sure to format cell C1 as a date. Now you can see the system’s build date.

How many days is that? Here’s a formula for cell D1:

=today()-C1

Need it in years? Here’s a formula for cell E1:

=D1/365

And there you go. In my case, 4e87c777 means the computer was built 2 October 2011, which sounds about right. It’s aging well.

If you want to query a remote machine, simply modify the command line:

reg query "\\COMPUTERNAME\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v InstallDate

Caveat: Occasionally certain numbers confuse Excel. If your build date is six regular numbers followed by the letter “e” and two more regular numbers, such as

123456e12

Excel is going to think you’re trying to use scientific notation. Change the last digit to the letter “a” so Excel will read the whole thing as a hexadecimal number. You’ll throw the build date off by a few seconds doing that, but that’s probably OK.

%d bloggers like this:
WordPress Appliance - Powered by TurnKey Linux