Re: regedit quickie

From: Colin Forde (c.forde@qub.ac.uk)
Date: 05/20/02


From: "Colin Forde" <c.forde@qub.ac.uk>
Date: Mon, 20 May 2002 15:00:40 +0100


Doug
Same error

Line 6
Char 1
Invalid root in registry key
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\syste
m\DisableRegistryTools"
Code 80070005
Source wshshell.regwrite

File executed:

'Start of script
Set WSHShell = WScript.CreateObject("WScript.Shell")
P1 =
"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system
\DisableRegistryTools"

WshShell.RegWrite P1,0,"REG_DWORD"
Set WshShell = Nothing
'End Script

I ran it under an ordinary user in the admin group user and it works fine.

In my batfile which is kicked off in startup an edit is done successfully
using regedit4 to the same hive before I run your script but not to
policies\system. Whenever I try to change system\disableregistrytools using
your script I get the error message.

We run visual basic 6 on these machines. I was using its vb script to run
the file you gave me.

Colin

"Doug Knox MS-MVP" <dknox@mvps.org> wrote in message
news:OFLltm$$BHA.2384@tkmsftngp02...
Colin,

Here's a modified version, the strings are correct, and the script works
fine on all 4 XP machines here:

If you're using the logon script approach, its possible that the script is
executing before the CURRENT_USER hive has been loaded. This would give you
the error message that you're seeing.

'Start of script
Set WSHShell = WScript.CreateObject("WScript.Shell")

P1 =
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\syste
m\DisableRegistryTools"
P2 =
"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system
\DisableRegistryTools"

WshShell.RegWrite p1,0,"REG_DWORD"
WshShell.RegWrite P2,0,"REG_DWORD"
Set WshShell = Nothing
'End Script

--
Doug Knox, MS-MVP Windows XP/9x
Win 95/98/Me/XP Tweaks and Fixes
http://www.dougknox.com
--------------------------------
Associate Expert
ExpertZone - http://www.microsoft.com/windowsxp/expertzone
--------------------------------
The newest resource for Windows XP!!
Windows XP From A-Z
http://www.kellys-korner-xp.com/xp_abc.htm
--------------------------------
Please reply only to the newsgroup so all may benefit.
Unsolicited e-mail is not answered.
"Colin Forde" <c.forde@queens-belfast.ac.uk> wrote in message
news:3CE8D633.DC0CEE7A@queens-belfast.ac.uk...
> Doug
> Tried your script but gets the message:
> Invalid root in registry key.
> Tried removing the key to see if it would create it to no avail.
> With the key in place it did not change its value but came up with same
error.
> The line in the error message looks perfect to me.
>
"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System
\DisplayRegistryTools"
> Would it no have to stop at system and then have someting else to add the
dword stringname and set it to 0.
> Colin
>
>
> Doug Knox MS-MVP wrote:
>
> > Colin (and Seth),
> >
> > I'm not familiar with the Novell Zenworks, but my first inclination
would be to check its options/polices thoroughly for a way to disable it
from disabling Regedit.  If that isn't possible, you can try setting the
permissions for
> >
> >
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System
> >
> > and the corresponding HKEY_LOCAL_MACHINE branch to allow the particular
User group, or a particular user, "Full Control"  This would allow a VB
Script or REG File to be used by any user.  A logon script would be your
best bet, and should override the Novell restrictions.
> >
> > 'Start of script
> > Set WSHShell = WScript.CreateObject("WScript.Shell")
> > P =
"SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\DisableRegistryTo
ols"
> > WshShell.RegWrite "HKLM\" & P,0,"REG_DWORD"
> > WshShell.RegWrite "HKCU\" & P,0,"REG_DWORD"
> > Set WshShell = Nothing
> > 'End Script
> >
> > Unfortunately, this isn't the most elegant solution, as the
HKEY_CURRENT_USER branch is for the currently logged in user. You can work
around this by using the instructions at:
http://www.dougknox.com/xp/tips/xp_adv_reg_editing.htm for modifying user's
Registry settings and permissions from one account.
> >
> > Just one note, Limited users can load Regedit, but by default, cannot
make changes to the Registry.
> >
> > --
> > Doug Knox, MS-MVP Windows XP/9x
> > Win 95/98/Me/XP Tweaks and Fixes
> > http://www.dougknox.com
> > --------------------------------
> > Associate Expert
> > ExpertZone - http://www.microsoft.com/windowsxp/expertzone
> > --------------------------------
> > The newest resource for Windows XP!!
> > Windows XP From A-Z
> > http://www.kellys-korner-xp.com/xp_abc.htm
> > --------------------------------
> > Please reply only to the newsgroup so all may benefit.
> > Unsolicited e-mail is not answered.
> >
> > "Colin Forde" <c.forde@qub.ac.uk> wrote in message
news:abgb4g$q67$1@news.qub.ac.uk...
> > > Doug
> > > We use Novell's zenworks to control workstations.
> > > Zenworks had a setting switched on that disabled registry tools. It
actually
> > > set the value of disableregistrytools to 1 in
> > >
hkey_current_user\software\microsoft\currentversion\windows\policies\system
> > > This was my problem.
> > > I 'm not out of the woods yet but :)
> > > We are running windows xp as I said.
> > > We also use DLU Dynamic Local User in zenworks. This system creates a
local
> > > username and removes the profile at logout.
> > > In winnt we can do some regediting of certain keys as the user loggs
in
> > > despite the fact that the tools are were disabled in zenworks. In xp
we can
> > > no longer do this but get the message saying that you cannot edit the
> > > registry. When I removed the zenworks prohibition I can then edit
certain
> > > keys but when I try to change system as above Im rejected. I get the
message
> > > saying that the key is already open by the system. I even got this
message
> > > when I completely removed disableregistrytools from the registry and
then
> > > tried to add it to system.  I need to be able to get that key in and
set to
> > > 1 after my foregoing other regedits.
> > > This is the current problem and I would very much appreciate any help
you
> > > can give. thanks for your time.
> > > best regards
> > > Colin
> > >
> > >
>


Relevant Pages

  • [ann] another way to call apis from script (the PB way)
    ... a dll and a typelib. ... you run the script, which will interface with a "standard" ... "COMforDLL" will work with a standard dll, ... work with win98 if I manually copied the winXP registry ...
    (microsoft.public.scripting.vbscript)
  • Re: Modify Registry on all SBS2003 clients
    ... registry setting to all workstations. ... command "REG ADD" to modify registry. ... the following command will change the registry value as your ... You may copy above command into the login script file SBS_LOGIN_SCRIPT.bat ...
    (microsoft.public.windows.server.sbs)
  • Re: Modify Registry on all SBS2003 clients
    ... logging on the client computer dont have administrative rights on the ... registry setting to all workstations. ... command "REG ADD" to modify registry. ... and put the command lines at the bottom of the script file. ...
    (microsoft.public.windows.server.sbs)
  • Re: Is there anyway to control the order of in which the [Run] entries are performed in the registry
    ... 3rd-party 'Startup Delayer' program or use a batch script, ... of these entries in the registry. ... Also, as I have also said, the 'Startup Delayer' ... run these commands from a 'Command Prompt' ...
    (microsoft.public.windowsxp.general)
  • Help with Outlook profile script
    ... I would like to have a script that checks if the correct Outlook profile is configured in the users profile. ... Outlook profiles are configured in the following registry key: ...
    (microsoft.public.scripting.vbscript)