How do I find the install time and date of Windows?
Another question elligeable 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
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.
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.
I've managed to find few files` date of creation which matches the real (clean) installation date of my Windows 10:
- in
C:\Windows
- in
C:\