Monday, November 20, 2006

Do u know when was ur Windows/Linux installed ??

Determine when the operating system was installed on a computer

The Win32_OperatingSystem WMI class can be used to gather useful information about the Operating System. It supports many properties, out of which the InstallDate property is used to determine the Operating System installation date in a computer.

Script to determine the Operating System installation date

To run the script, copy the following lines to a Notepad document, and save as a file with .VBS extension (use double-quotes) and double-click the file. The installation date and time would be displayed.

strComputer = "."
Set dtmInstallDate = CreateObject( _
"WbemScripting.SWbemDateTime")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
MsgBox "Install Date: " & getmydat (objOperatingSystem.InstallDate)
Next

Function getmydat(wmitime)
dtmInstallDate.Value = wmitime
getmydat = dtmInstallDate.GetVarDate
End function

Two more methods - For Windows XP Professional systems
Systeminfo.exe console-utility



Systeminfo command-line tool displays detailed configuration information about a computer and its operating system, including operating system configuration, security information, product ID, and hardware properties, such as RAM, disk space, and network cards. More information available at Microsoft Windows XP - Systeminfo http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/systeminfo.mspx?mfr=true


*WMIC - command-line tool

Click Start, Run and type:

CMD /K WMIC OS GET InstallDate

You'll see the Operating System installation date (in WMI format). The first eight characters in that output gives you the installation date.

Source : Chip Magazine Forum

No comments: