Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript read and write registry value to excel

Status
Not open for further replies.

rdecareau

MIS
Mar 26, 2003
1
US
Hi All,
I took a look at the Excel FAQ which has been very helpful for past projects. However, i've not been able to figure out how to get this script to work. I'm trying to read from Excel and then write the registry values to each Column in the spreadsheet. Any help would be appreciated.

Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002

on error resume next

set x = getobject(,"excel.application")
r = 2
do until len(x.cells(r, 1).value) = 0
strComputer = x.cells(r, 1).Value

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{2244BE80-C7C9-4A5A-9AB5-22B0A72D28F8}"
strValueName = "DisplayVersion"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
Wscript.Echo "MPIO Version FF DSM: " & strValue

strKeyPath = "SOFTWARE\Cisco Systems\VPN Client"
strValueName = "INSTALLTYPE"
oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
Wscript.Echo "INSTALLTYPE: " & strValue
 
Like replacing this:
Wscript.Echo "MPIO Version FF DSM: " & strValue
with this:
x.Cells(r, 2).Value = "MPIO Version FF DSM: " & strValue

and this:
Wscript.Echo "INSTALLTYPE: " & strValue
with this ?
x.Cells(r, 3).Value = "INSTALLTYPE: " & strValue

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top