Otra pregunta elligeable para un 'code-challenge': aquí hay algunos ejecutables de código fuente para resolver el problema, pero no están completos.
¿Encontrará un script vb que cualquiera pueda ejecutar en su computadora, con el resultado esperado?
systeminfo|find /i "original"
le daría la fecha real ... no es el número de segundos;)
Como Sammycomments, find /i "install"
da más de lo necesario.
Y esto solo funciona si la configuración regional es el inglés: debe coincidir con el idioma.
Para sueco esto sería "ursprungligt
" y "ursprüngliches
" para alemán.
En PowerShell script de Windows, usted podría escribir:
PS > $os = get-wmiobject win32_operatingsystem
PS > $os.ConvertToDateTime($os.InstallDate) -f "MM/dd/yyyy"
Mediante el uso de WMI (Windows Management Instrumentation)
Si usted no utiliza WMI, debe leer a continuación, convertir el valor del registro:
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"
El resto de esta publicación le brinda otras formas de acceder s esa misma información. Escoger su veneno;)
en VB.Net que daría algo así como:
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
En Autoit (un lenguaje de script de Windows), que sería:
;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
En Delphy 7, eso sería g o como:
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;
Eso es genial, ¿hay algún lugar especial al que fue para obtener esa información o simplemente lo sabía? –
Funciona muy bien, excepto si Windows se instaló usando una imagen de disco. ¿Hay alguna manera de verificar la creación del perfil de los usuarios para resolver este problema? –
no funciona refleja el último servicepack/actualización Fecha de instalación (EA la versión actual, no la versión original de la instalación. – user3800527