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!

Checking/Modifying registry keys

Status
Not open for further replies.

Jeffro1182

Technical User
Sep 5, 2007
1
US
Hello All,

I am *very* new to VBScripting and I am attempting to write a script that automates the changing of specific Internet Explorer 6 settings. Currently I just have a series of commands (like the one I have included below) that just goes through and sets the value.

I'm curious, is there a better/safer way to make these changes? Perhaps checking the value of the key first and leaving it alone if it already set correctly? Warning if the key doesn't exist, etc..?

If anyone would be willing to provide me with some example/idea code I would be extremely grateful.

jeff

Code:
'   Disable caching of SSL pages
HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strKeyPath = "Software\Microsoft\Windows\CurrentVersion\Internet Settings"
objReg.CreateKey HKEY_CURRENT_USER, strKeyPath
ValueName = "DisableCachingOfSSLPages"
dwValue = 0
objReg.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, ValueName, dwValue
 
If the key does not already exist...you're taking care of it with your CreateKey; if it already exist and has the correct value...you're not loosing anything by re-setting it to what you want it to be and it probably takes just as long as if you checked for the value first.

--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top