Page 1 of 1

Cannot apply change to registry

Posted: Tue May 15, 2007 12:15 pm
by Incroyable HULK
Hello all,
I am trying to modify a registry setting on Windows XP with a VBScript and I am unsuccesfull with the following two methods:

Method 1

Code: Select all

Const HKEY_CURRENT_USER = &H80000001
Set objRegistry = GetObject("winmgmts:.rootdefault:StdRegProv")
strKeyPath = "SoftwareMicrosoftWindowsCurrentVersionInternet SettingsZone1"
strValueName = "1406"
dwValue = 0
objRegistry.SetDWORDValue HKEY_CURRENT_USER, strKeyPath, strValueName, dwValue


Method 2

Code: Select all

Dim wshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.RegWrite "HKCUSoftwareMicrosoftWindowsCurrentVersionInternet SettingsZone11406", 0, "REG_DWORD"


I don't get any error message but nothing is applied. I had the same issue with another setting I was trying to set on Vista and I ended up calling and external .reg file applied from the VBScript...

Incroyable HULK2007-05-15 19:29:21

Cannot apply change to registry

Posted: Tue May 15, 2007 4:26 pm
by jvierra
It's a restricted key. REG and regedit can access it directly because tehy ask for more privileges whereas WMI, by default, doesn't. You might be able to get around this by asking for more tokens in WMI. I tried it with "security" but I think you also need "registry" privileges.
I tried it like this:
Set objRegistry = GetObject("winmgmts:{(security,backup)}.rootdefault:StdRegProv")
It still won't work so there is still a privilege missing. If you look at the values "permissions" you will see that it is "protected/read" and script usually runs with low privileges.


Cannot apply change to registry

Posted: Tue Jun 19, 2012 9:15 am
by rs6000101
Here's somthisng that you might want to try as long as yo have local admin privlidges you can make registry changes to a list of of machines I use this simple script i've made changes up to 75 machines at one time with no poblem.

File 1: REG-ADD.cmd.txt (add the registry entry)
File 2: Hostnames.txt (place either IP or machine name both methods works fineuploads/50517/Reg-Add.zip)

if you need further assistance you may reach me at rs6000@linuxwaves.com

Cannot apply change to registry

Posted: Fri Jun 22, 2012 3:13 am
by jvierra
Hah! I haven't heard mention of an RS6000 for a decade. Good box.