150

This might sound like a little bit of a crazy question, but how can I find out (hopefully via an API/registry key) the install time and date of Windows?

The best I can come up with so far is to look at various files in C:\Windows and try to guess... but that's not exactly a nice solution.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Free Wildebeest
  • 7,272
  • 8
  • 38
  • 42

20 Answers20

185

TLDR

IMPORTANT NOTE if Windows was "installed" using a disk image both methods fail.

Method 1 works if windows haven't been upgraded to a new major version (e.g. Windows 10 to Windows 11). You execute the command systeminfo and look for a line beginning with "Original Install Date" (or something like that in your local language). You can get the same version by querying WMI and by looking at the registry. if windows was upgraded to a new major version this method unfortunately gives you the date of installation of the new major version. Here's an example to check the version by running systeminfo from PowerShell:

systeminfo | sls "original"

Method 2 This seems to work correctly even after a major update. You get the installation date by checking the creation time of the file system.ini which seems to stay untouched. e.g. with PowerShell:

 (Get-Item "C:\Windows\system.ini").CreationTime

Details

Another question eligible for a 'code-challenge': here are some source code executables to answer the problem, but they are not complete. Will you find a VBScript that anyone can execute on his/her computer, with the expected result?


systeminfo|find /i "original"

would give you the actual date... not the number of seconds ;)

But (caveat), as noted in the 2021 comments by Salman A and AutoMattTick

If Windows was updated to a newer version, this seems to give the date on which Windows was RE-installed.


As Sammy comments, find /i "install" gives more than you need. And this only works if the locale is English: It needs to match the language. For Swedish this would be "ursprungligt" and "ursprüngliches" for German.

Andy Gauge proposes in the comments:

shave 5 characters off with

systeminfo|find "Original"

In Windows PowerShell script, you could just type:

PS > $os = get-wmiobject win32_operatingsystem
PS > $os.ConvertToDateTime($os.InstallDate) -f "MM/dd/yyyy"

By using WMI (Windows Management Instrumentation)

If you do not use WMI, you must read then convert the registry value:

PS > $path = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion'
PS > $id = get-itemproperty -path $path -name InstallDate
PS > $d = get-date -year 1970 -month 1 -day 1 -hour 0 -minute 0 -second 0
## add to hours (GMT offset)
## to get the timezone offset programatically:
## get-date -f zz
PS > ($d.AddSeconds($id.InstallDate)).ToLocalTime().AddHours((get-date -f zz)) -f "MM/dd/yyyy"

The rest of this post gives you other ways to access that same information. Pick your poison ;)


In VB.Net that would give something like:

Dim dtmInstallDate As DateTime
Dim oSearcher As New ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem")
For Each oMgmtObj As ManagementObject In oSearcher.Get
    dtmInstallDate =
        ManagementDateTimeConverter.ToDateTime(CStr(oMgmtO bj("InstallDate")))
Next

In Autoit (a Windows scripting language), that would be:

;Windows Install Date
;
$readreg = RegRead("HKLM\SOFTWARE\MICROSOFT\WINDOWS NT\CURRENTVERSION\", "InstallDate")
$sNewDate = _DateAdd( 's',$readreg, "1970/01/01 00:00:00")
MsgBox( 4096, "", "Date: " & $sNewDate )
Exit

In Delphy 7, that would go as:

Function GetInstallDate: String;
Var
  di: longint;
  buf: Array [ 0..3 ] Of byte;
Begin
  Result := 'Unknown';
  With TRegistry.Create Do
  Begin
    RootKey := HKEY_LOCAL_MACHINE;
    LazyWrite := True;
    OpenKey ( '\SOFTWARE\Microsoft\Windows NT\CurrentVersion', False );
    di := readbinarydata ( 'InstallDate', buf, sizeof ( buf ) );
//    Result := DateTimeToStr ( FileDateToDateTime ( buf [ 0 ] + buf [ 1 ] * 256 + buf [ 2 ] * 65535 + buf [ 3 ] * 16777216 ) );
showMessage(inttostr(di));
    Free;
  End;
End;

As an alternative, CoastN proposes in the comments:

As the system.ini-file stays untouched in a typical windows deployment, you can actually get the install-date by using the following oneliner:

(PowerShell): (Get-Item "C:\Windows\system.ini").CreationTime
Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • while using autoIt3.0 I found we need to add header file for function _DateAdd and its #include – shahjapan Apr 25 '10 at 07:50
  • @Pedro77 do you have an error message? oDo you have a gnu find (http://superuser.com/q/312135/141) which would mask the Windows system "find.exe" command? – VonC May 17 '13 at 15:09
  • 2
    I found out why. It is because my Windows is not in english. :) – Pedro77 May 17 '13 at 18:53
  • 3
    Use `systeminfo|find /i "original"` to only filter the "Original Install Date". If you use "install" as string you will get more information than you need. Also, if the locale is not English then this will probably not work. It needs to match the language. For Swedish this would be "ursprungligt" and "ursprüngliches" for German. – Samir Dec 03 '13 at 00:48
  • @Sammy good points. I have included those in the answer for more visibility. – VonC Dec 03 '13 at 03:41
  • 2
    For me systeminfo|find /i "original" returned 6/30/2017 which had to have been some windows update as I've had the machine for around 4 years. – Tim Jan 10 '18 at 14:09
  • @Tim That means the search was not specific enough? What `systeminfo|find /i "original install"` does return in your case? – VonC Jan 10 '18 at 14:11
  • "Original Install Date: 6/30/2017, 2:33:41PM" Looking through all of the output of systeminfo, there really aren't any other dates but system boot time and the date in the Bios version. – Tim Jan 11 '18 at 15:05
  • @Tim OK. What version of Windows are you using? – VonC Jan 11 '18 at 15:09
  • Windows 10 Pro . – Tim Jan 14 '18 at 02:25
  • 1
    @Tim I confirm and see the same (too recent) date as you do. So https://stackoverflow.com/a/44539474/6309 might be more what you are looking for. – VonC Jan 14 '18 at 07:23
  • 1
    I just went through this but with 245 hotfixes by default the CMD window didn't have enough vertical lines to display the entire 'systeinfo' output. Was scratching my head for a minute. Followed this to fix it: https://stackoverflow.com/questions/1740876/more-lines-in-command-window – asdf30 Dec 01 '18 at 14:57
  • As the system.ini-file stays untouched in a typical windows deployment, you can actually get the install-date by using the following oneliner (PowerShell): `(Get-Item "C:\Windows\system.ini").CreationTime` – CoastN Nov 05 '19 at 15:52
  • @CoastN Thank you. I have included your comment in the answer for more visibility. – VonC Nov 05 '19 at 15:57
  • 2
    It shows that I installed the system two weeks ago, but in fact it was a year or two. It seems that this is a date of the last large upgrade. – hans Mar 19 '20 at 14:09
  • 1
    @hans Strange. Maybe that has changed since the time I wrote the answer (more than 11 years ago) – VonC Mar 19 '20 at 15:25
  • Indeed, more than 11 years! I did not check the date, I assumed that googling windows 10 will point me to sth more recent ;) – hans Mar 19 '20 at 15:40
  • shave 5 characters off with `systeminfo|find "Original"` – Andy Gauge May 25 '21 at 15:53
  • @AndyGauge Thank you. I have included your comment in the answer for more visibility. – VonC May 25 '21 at 20:11
  • If Windows was updated to a newer version, this seems to give the date on which Windows was RE-installed. – Salman A Sep 20 '21 at 13:22
  • @SalmanA Interesting. I never tested that particular scenario. – VonC Sep 20 '21 at 16:08
  • Mine also reports a date that is too recent (6 months ago when the actual install was 2 years). @VonC I'd recommend editing your answer to caveat that recently there are reports of these dates being modified, possibly by Windows Update. (It might be an old answer but still one of google's highest results for it.) – AutoMattTick Sep 21 '21 at 14:04
  • 1
    @AutoMattTick Thank you for the feedback. I have edited the answer to include the caveat. Let me know if I missed anything. – VonC Sep 21 '21 at 14:54
  • @VonC are you OK with me adding a brief TLDR at the top of your otherwise very informative answer? – ndemou Mar 05 '22 at 19:49
  • @ndemou Sure, thank you so much for updating this 13+ years old answer! – VonC Mar 05 '22 at 20:09
95

In regedit.exe go to:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate

It's given as the number of seconds since January 1, 1970. (Note: for Windows 10, this date will be when the last feature update was installed, not the original install date.)

To convert that number into a readable date/time just paste the decimal value in the field "UNIX TimeStamp:" of this Unix Time Conversion online tool.

MikeS159
  • 1,884
  • 3
  • 29
  • 54
Tommy
  • 1,048
  • 8
  • 4
65

We have enough answers here but I want to put my 5 cents.

I have Windows 10 installed on 10/30/2015 and Creators Update installed on 04/14/2017 on top of my previous installation. All of the methods described in the answers before mine gives me the date of the Creators Update installation.

Original Install Date

I've managed to find few files` date of creation which matches the real (clean) installation date of my Windows 10:

  • in C:\Windows

Few C:\Windows files

  • in C:\

Few C:\ files


By the way, an easy way to get the 10 oldest (by creation) files in C:\ and C:\windows is to run these 2 commands on an administrative powershell session:

dir -Force C:\ | sort -Property creationtime  | select -Property name, creationtime -First 10
dir -Force C:\windows | sort -Property creationtime  | select -Property name, creationtime -First 10
ndemou
  • 4,691
  • 2
  • 30
  • 33
Nikolay Kostov
  • 16,433
  • 23
  • 85
  • 123
  • 7
    Better then the other answers, but how about imaged deployments ? – Peter Jan 29 '18 at 08:16
  • 8
    This is definitely closer to the correct answer; the other solutions no longer work with Windows 10 upgrades. However, none of the 5 files/folders listed here had the correct date on my system (some were later and some where actually earlier). However, I found 1 file and 2 folders with the correct date on my system: C:\Windows\hbcikrnl.ini, C:\Windows\symbols\, & C:\Windows\CSC\. So, if you know when it was approximately, go to C:\Windows\, show system system files, sort by date, and find something that looks right. – Matt Jacobi Feb 01 '18 at 16:49
  • 1
    For my Windows 10 system.ini, BOOTNXT and bootmgr had the correct date. Win.ini & $Recycle.Bin had newer dates. – Keith Mar 03 '18 at 00:54
  • The date for `system.ini` made no sense on my Windows 7 and 2008 machines, it appears that the created timestamp from the installation sources is being copied at installation. `C:\pagefile.sys` had the correct timestamp. – Daniel Sokolowski Oct 12 '18 at 23:56
47

Open command prompt, type "systeminfo" and press enter. Your system may take few mins to get the information. In the result page you will find an entry as "System Installation Date". That is the date of windows installation. This process works in XP ,Win7 and also on win8.

Daman Mokha
  • 372
  • 1
  • 3
  • 16
22

How to find out Windows 7 installation date/time:

just see this...

  • start > enter CMD
  • enter systeminfo

that's it; then you can see all information about your machine; very simple method

Dariusz Woźniak
  • 9,640
  • 6
  • 60
  • 73
ani alexander
  • 247
  • 2
  • 2
14

Ever wanted to find out your PC’s operating system installation date? Here is a quick and easy way to find out the date and time at which your PC operating system installed(or last upgraded).

Open the command prompt (start-> run -> type cmd-> hit enter) and run the following command

systeminfo | find /i "install date"

In couple of seconds you will see the installation date

Dariusz Woźniak
  • 9,640
  • 6
  • 60
  • 73
Robin
  • 149
  • 1
  • 2
13

In Powershell run the command:

systeminfo | Select-String "Install Date:"
user3827180
  • 131
  • 1
  • 2
8

Windows 10 OS has yet another registry subkey, this one in the SYSTEM hive file:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\Setup\

The Install Date information here is the original computer OS install date/time. It also tells you when the update started, ie

 Computer\HKEY_LOCAL_MACHINE\SYSTEM\Setup\Source OS (Updated on xxxxxx)."

This may of course not be when the update ends, the user may choose to turn off instead of rebooting when prompted, etc...

The update can actually complete on a different day, and

Computer\HKEY_LOCAL_MACHINE\SYSTEM\Setup\Source OS (Updated on xxxxxx)"

will reflect the date/time it started the update.

Panki
  • 119
  • 8
Amit Gupta
  • 81
  • 1
  • 1
5

I find the creation date of c:\pagefile.sys can be pretty reliable in most cases. It can easily be obtained using this command (assuming Windows is installed on C:):

dir /as /t:c c:\pagefile.sys

The '/as' specifies 'system files', otherwise it will not be found. The '/t:c' sets the time field to display 'creation'.

MoonDogg
  • 67
  • 1
  • 1
  • 1
    That would give the creation date of the pagefile, which is totally unrelated to the install date of the OS itself. It can be recreated for a number of reasons and even tampered with if you really want. That's not a reliable method. – Alejandro Jun 06 '18 at 17:09
  • 1
    It's not 'totally unrelated', as it gets created during the initial install. So unless it's been intentionally recreated or deleted at some point, in 'most cases' the creation date will be the same as the initial install date, as it persists through upgrades. Yes, it's not 100% reliable, but it's quick and easy, and I would guess accurate in far more cases than not. Definitely more so than many of the answers here. – MoonDogg Jun 07 '18 at 18:24
  • You can re-create that file at any moment and if method does not guarantee the right result 100% of a time, no one can really rely on it. – Slava Murygin Feb 08 '19 at 20:15
  • For me, this gives the most accurate date compared to all other answers. You can check the date for System Volume Information folder instead if pagefile.sys was deleted at some point, moved to another partition or disk, or if you have some doubt. – Salman A Sep 20 '21 at 13:28
4

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate and systeminfo.exe produces the wrong date.

The definition of UNIX timestamp is timezone independent. The UNIX timestamp is defined as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970 and not counting leap seconds.

In other words, if you have installed you computer in Seattle, WA and moved to New York,NY the HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate will not reflect this. It's the wrong date, it doesn't store timezone where the computer was initially installed.

The effect of this is, if you change the timezone while running this program, the date will be wrong. You have to re-run the executable, in order for it to account for the timezone change.

But you can get the timezone info from the WMI Win32_Registry class.

InstallDate is in the UTC format (yyyymmddHHMMSS.xxxxxx±UUU) as per Microsoft TechNet article "Working with Dates and Times using WMI" where notably xxxxxx is milliseconds and ±UUU is number of minutes different from Greenwich Mean Time.

 private static string RegistryInstallDate()
    {

        DateTime InstallDate = new DateTime(1970, 1, 1, 0, 0, 0);  //NOT a unix timestamp 99% of online solutions incorrect identify this as!!!! 
        ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT * FROM Win32_Registry");

        foreach (ManagementObject wmi_Windows in searcher.Get())
        {
            try
            {
                ///CultureInfo ci = CultureInfo.InvariantCulture;
                string installdate = wmi_Windows["InstallDate"].ToString(); 

                //InstallDate is in the UTC format (yyyymmddHHMMSS.xxxxxx±UUU) where critically
                // 
                // xxxxxx is milliseconds and       
                // ±UUU   is number of minutes different from Greenwich Mean Time. 

                if (installdate.Length==25)
                {
                    string yyyymmddHHMMSS = installdate.Split('.')[0];
                    string xxxxxxsUUU = installdate.Split('.')[1];      //±=s for sign

                    int year  = int.Parse(yyyymmddHHMMSS.Substring(0, 4));
                    int month = int.Parse(yyyymmddHHMMSS.Substring(4, 2));
                    int date  = int.Parse(yyyymmddHHMMSS.Substring(4 + 2, 2));
                    int hour  = int.Parse(yyyymmddHHMMSS.Substring(4 + 2 + 2, 2));
                    int mins  = int.Parse(yyyymmddHHMMSS.Substring(4 + 2 + 2 + 2,  2));
                    int secs  = int.Parse(yyyymmddHHMMSS.Substring(4 + 2 + 2 + 2 + 2, 2));
                    int msecs = int.Parse(xxxxxxsUUU.Substring(0, 6));

                    double UTCoffsetinMins = double.Parse(xxxxxxsUUU.Substring(6, 4));
                    TimeSpan UTCoffset = TimeSpan.FromMinutes(UTCoffsetinMins);

                    InstallDate = new DateTime(year, month, date, hour, mins, secs, msecs) + UTCoffset; 

                }
                break;
            }
            catch (Exception)
            {
                InstallDate = DateTime.Now; 
            }
        }
        return String.Format("{0:ddd d-MMM-yyyy h:mm:ss tt}", InstallDate);      
    }
Markus
  • 420
  • 3
  • 7
  • The definition of a UNIX Timestamp does include a timezone, UTC. If a computer is installed at 6:00 PM New York time and 3:00 PM Seattle time on the same day, they will have the same UNIX Timestamp because they were installed at the same time UTC. If you installed on April 1, 2018 at 3:00 PM in Seattle and move to New York and then convert from UTC to your local time, it will say April 1, 2018 at 6:00 PM and be correct, because it was 6:00 PM in New York when you installed in Seattle. – jla Mar 27 '18 at 19:14
  • Thank you jla, I was not clear in my post. When you change the timezone on the fly whilst the program is running, the timezone change will no be reflected. You have to restart the program for timezone to take effect. This is same behavior as Powershell. – Markus Mar 28 '18 at 14:42
  • The InstallDate returns the local time with the current timezone applied, and also the timezone in the +XXX form. When the timezone changes, the install date changes and also the timezone. If the installation date in UTC was 2000-01-01T12:00:00Z. The InstallDate is 20000101120000.000000+000. Set the timezone to UTC+5, and it becomes 20000101170000.000000+300. When using the above code, the timezone gets added twice. To get the UTC date, the "InstallDate =" line should be changed to: InstallDate = new DateTime(year, month, date, hour, mins, secs, msecs, DateTimeKind.Utc) - UTCoffset; – Jesús Diéguez Fernández Apr 10 '19 at 09:30
2

Determine the Windows Installation Date with WMIC

wmic os get installdate

Lko Jegue
  • 21
  • 2
  • 1
    This probably just reads the InstallDate registry key and has the same problem; it changes on build updates. – Anders Dec 22 '18 at 19:30
2

Very simple way from PowerShell:

(Get-CimInstance -Class Win32_OperatingSystem).InstallDate

Extracted from: https://www.sysadmit.com/2019/10/windows-cuando-fue-instalado.html

1

In RunCommand write "MSINFO32" and hit enter It will show All information related to system

shailesh
  • 1,783
  • 2
  • 17
  • 26
1

You can simply check the creation date of Windows Folder (right click on it and check properties) :)

farhad.kargaran
  • 2,233
  • 1
  • 24
  • 30
1

Use speccy. It shows the installation date in Operating System section. http://www.piriform.com/speccy

Amin
  • 27
  • 1
  • 1
    Not a programming solution. If there's some kind of interface that Powershell (for example) can interact with, list it. – Tyler Montney Dec 27 '18 at 15:47
1

Try this powershell command:

Get-ChildItem -Path HKLM:\System\Setup\Source* | 
 ForEach-Object {Get-ItemProperty -Path Registry::$_} | 
     Select-Object ProductName, ReleaseID, CurrentBuild, @{n="Install Date"; e={([DateTime]'1/1/1970').AddSeconds($_.InstallDate)}} | 
         Sort-Object "Install Date"
Future
  • 388
  • 8
  • 21
  • Almost true and it should be noted a lot more since this takes into account build updates which alter the key in HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion but one needs both combined since the Source OS keys are not even present if a system was never actually updated (yet) and would also be missing the date of the last build update – Syberdoor Oct 10 '19 at 14:03
1

After trying a variety of methods, I figured that the NTFS volume creation time of the system volume is probably the best proxy. While there are tools to check this (see this link ) I wanted a method without an additional utility. I settled on the creation date of "C:\System Volume Information" and it seemed to check out in various cases.

One-line of PowerShell to get it is:

([DateTime](Get-Item -Force 'C:\System Volume Information\').CreationTime).ToString('MM/dd/yyyy')
SHR
  • 7,940
  • 9
  • 38
  • 57
greatquux
  • 11
  • 1
1

You can also check the check any folder in the system drive like "windows" and "program files". Right click the folder, click on the properties and check under the general tab the date when the folder was created.

Tekki
  • 39
  • 1
  • 6
    Although valid - this is not a programming solution – Matt Wilko Aug 24 '11 at 11:46
  • @Matt He give you the algorithm in Natural Lenguaje, so Just Copile it in a human device! :D – Jonathan Mar 05 '12 at 19:51
  • 3
    In newer versions of Windows, which use image-based installation (`.WIM` files), the created date is when Microsoft created the image, not when the OS was installed on a particular machine. – ctype.h Nov 02 '12 at 03:13
0

Press WindowsKey + R and enter cmd

In the command window type:

systeminfo | find /i "Original"

(for older versions of windows, type "ORIGINAL" in all capital letters).

Nathaniel J. Smith
  • 11,613
  • 4
  • 41
  • 49
  • Anyone know why the down vote? Worked for me, is it maybe not accurate for some reason? Maybe explain when giving a down vote – russelrillema Jul 16 '18 at 09:31
  • @russelrillema the last major service pack overrides this date. – Don Tomato Jul 18 '19 at 10:31
  • If you have windows 10 v1809 go to Settings > System > About. Find Windows Specification and there you have a field by the name "Install on". (Note: Not sure if it works on older versions of windows) – abdullahjavaid86 Aug 03 '19 at 07:46
0

You can do this with PowerShell:

Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\' -Name InstallDate |
    Select-Object -Property @{n='InstallDate';e={[DateTime]::new(1970,1,1,0,0,0,0,'UTC').AddSeconds($_.InstallDate).ToLocalTime()}}
Bacon Bits
  • 30,782
  • 5
  • 59
  • 66