How do I find the install time and date of Windows?

WindowsInstallation

Windows Problem Overview


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.

Windows Solutions


Solution 1 - Windows

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 begining 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 vb script 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

Solution 2 - Windows

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.

Solution 3 - Windows

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

Solution 4 - Windows

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.

Solution 5 - Windows

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

Solution 6 - Windows

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

Solution 7 - Windows

In Powershell run the command:

systeminfo | Select-String "Install Date:"

Solution 8 - Windows

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.

Solution 9 - Windows

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'.

Solution 10 - Windows

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);      
    }

Solution 11 - Windows

Determine the Windows Installation Date with WMIC

wmic os get installdate

Solution 12 - Windows

Very simple way from PowerShell:

(Get-CimInstance -Class Win32_OperatingSystem).InstallDate

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

Solution 13 - Windows

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

Solution 14 - Windows

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.

Solution 15 - Windows

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

Solution 16 - Windows

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

Solution 17 - Windows

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')

Solution 18 - Windows

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).

Solution 19 - Windows

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()}}

Solution 20 - Windows

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"

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionFree WildebeestView Question on Stackoverflow
Solution 1 - WindowsVonCView Answer on Stackoverflow
Solution 2 - WindowsTommyView Answer on Stackoverflow
Solution 3 - WindowsNikolay KostovView Answer on Stackoverflow
Solution 4 - Windowsdiptangshu senguptaView Answer on Stackoverflow
Solution 5 - Windowsani alexanderView Answer on Stackoverflow
Solution 6 - WindowsRobinView Answer on Stackoverflow
Solution 7 - Windowsuser3827180View Answer on Stackoverflow
Solution 8 - WindowsAmit GuptaView Answer on Stackoverflow
Solution 9 - WindowsMoonDoggView Answer on Stackoverflow
Solution 10 - WindowsMarkusView Answer on Stackoverflow
Solution 11 - WindowsLko JegueView Answer on Stackoverflow
Solution 12 - WindowsNick MurtaughView Answer on Stackoverflow
Solution 13 - WindowsAminView Answer on Stackoverflow
Solution 14 - WindowsTekkiView Answer on Stackoverflow
Solution 15 - WindowsshaileshView Answer on Stackoverflow
Solution 16 - Windowsfarhad.kargaranView Answer on Stackoverflow
Solution 17 - WindowsgreatquuxView Answer on Stackoverflow
Solution 18 - Windowsabdullahjavaid86View Answer on Stackoverflow
Solution 19 - WindowsBacon BitsView Answer on Stackoverflow
Solution 20 - WindowsFutureView Answer on Stackoverflow