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

edit registry value in vista 1

Status
Not open for further replies.

pbuddy2007

Technical User
Feb 9, 2008
17
0
0
CA
I'm trying to write & edit registry values in Vista using :

Code:
Dim wsh
Set wsh = CreateObject("WScript.Shell")

X = 1

wsh.regwrite "HKEY_LOCAL_MACHINE\SOFTWARE\MySoft\SavedData\Profile" & X & "\ProjectName" & X & "\", txtProjectName.Text, "REG_SZ"

I'm getting a runtime error, Is there any other way to write & read values in Vista ?





thanks !
 
In Vista and WS08 most of the HKLM hive is protected from user writes without elevation.

What are you writing this in? On the one hand it looks like a WSH script but you seem to have a very VB-like Textbox there too.
 
Nevermind the last question. I forgot I was in the VB5/6 forum and your weak typing of [tt]wsh[/tt] threw me off.


To add to the useful part above, Microsoft has suggested people back off using the registry for application settings and go back to INI files, XML files (app.config), etc. These should be stored in either per-computer or per-user filesystem locations as appropriate and not the installed EXE's folder.
 
I really need to write my data in the registry otherwise I'll need to do some major modification to my code and I'm way to lazy to do it. If the HKLM is blocked where else in Vista can I write in the registry ?
 
HKCU is pretty much it except in special cases. Otherwise you have to hack around making parts of HKLM writeable, and do this on every machine you deploy to.

I'm assuming you want to alter these items at runtime and not just during installation. An elevated installer can write wherever it needs to.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top