Another question: “Vulnerability for code-challenge ”: here are some source codes for the source code to answer the problem, but they are not complete.
Do you find a vb script that anyone can execute on their computer with the expected result?
systeminfo|find /i "original"
will give you the actual date ... not the number of seconds;)
Since Sammy comments , find /i "install" gives more than you need.
And this only works if the language is English: it must match the language.
For Swedish, this will be ursprungligt and ursprüngliches for German.
In a Windows PowerShell script, you can simply type:
PS > $os = get-wmiobject win32_operatingsystem PS > $os.ConvertToDateTime($os.InstallDate) -f "MM/dd/yyyy"
Using WMI ( Windows Management Tool )
If you are not using WMI, you should 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
The rest of this post gives you other ways to access the same information. Choose your poison;)
In VB.Net, this will 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 will look like this:
;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, it will look like:
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 ) );