Script to determine the Operating System installation date

4 Jul

http://windowsxp.mvps.org/getosdate.htm

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.

‘ © 2006 Ramesh Srinivasan.
‘Returns the Operating System installation date.

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