Created
June 2, 2014 12:21
-
-
Save bhensley/67a1777b445ce21adb05 to your computer and use it in GitHub Desktop.
Check the registry for the known install date of a Windows system and output via InputBox (for easy copying). I never thought I'd be thankful for having learned Visual Basic a decade ago...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dim shell, val, regKey | |
On Error Resume Next | |
' UNIX time of OS installation | |
regKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\InstallDate" | |
' Invoke WScript and read the key | |
Set shell = CreateObject("WScript.Shell") | |
val = shell.RegRead(regKey) | |
' If an error was found then set "Not Found" otherwise set the found install date | |
If err.number <> 0 Then | |
readFromRegistry = "Not Found" | |
Else | |
readFromRegistry = val | |
End If | |
' Clean up | |
Set shell = Nothing | |
' And output to screen using InputBox, so it can be easily copied | |
Call InputBox("Install Date", "Windows Install Date", readFromRegistry) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment