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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Registry 1

Status
Not open for further replies.

Azzuri

Programmer
Apr 16, 2002
18
CA
Hello,

I am trying to write a script in VB6 that will read a registry value and send it to a database. I was hoping someone could lead me in the right direction as to how to go about writing a script like this. If someone has sample code or knows were there is good info, please let me know. Thanks for the help.
 
I would use WMI - try modifying this code i wrote for creating registry keys

'*************** Set Registry Values ***************
strNewKey = "Software\MYNewKey\"
strMethodCreateKey = "CreateKey"
Set objRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}//" & strSelected & "/root/default:StdRegProv")

'*************** Create Key ***************
Set objMethod = objRegistry.Methods_(strMethodCreateKey)
Set objInParam = objMethod.inParameters.SpawnInstance_()
objInParam.hDefKey = HKLM
objInParam.sSubKeyName = strNewKey
Set objOutParam = objRegistry.ExecMethod_(strMethodCreateKey, objInParam)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top