'---------------------------------------------------------------------------------------
' Procedure : jackfeb5
' Author : mellon
' Date : 05/02/2015
' Purpose : Using WScript to get registry key values.
' I do not have values for RegisteredTo or RegisteredOrganization
'
'RegisteredTo may be an invalid name , it gives me a can't open for read
'so I added the error/resume to bypass and continue
'---------------------------------------------------------------------------------------
'
Sub jackfeb5()
Dim myWS As Object
Dim OpSystem As String
Dim RegisteredTo As String
Dim RegisteredOwner As String
Dim RegisteredOrganization As String
10 On Error Resume Next 'added because it gives an error on RegisteredTo
'unable to open registry key for Reading???
'access Windows scripting
20 Set myWS = CreateObject("WScript.Shell")
'read key from registry,
'Who Windows is registered to?
'Who is the Owner
'Who is organization
30 RegisteredTo = myWS.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredTo")
40 RegisteredOwner = myWS.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOwner")
50 RegisteredOrganization = myWS.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization")
60 Debug.Print "RegisteredTo " & RegisteredTo
70 Debug.Print "RegisteredOwner " & RegisteredOwner
80 Debug.Print "RegisteredOrganization " & RegisteredOrganization
'read key from registry, what version of Windows?
90 OpSystem = myWS.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName")
100 Debug.Print "OpSystem " & OpSystem
End Sub