Run a .REG file in a logon script where regedit is disabled?
Solution 1:
Did you try REG.EXE?
REG.EXE allows you to do many Registry operations from a command line. This can be useful when you want to quickly make a change without opening RegEdit, and it also allows you to embed registry operations in logon scripts and batch files.
Solution 2:
Why not use a WMI script, run using cscript.exe.
' taken from
' http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/registry/
' computer name we want to modify ("." for local, "pcname" for remote pc, no "\\" needed)
strComputer = "."
' leave these constants
const HKEY_LOCAL_MACHINE = &H80000002
Set StdOut = WScript.StdOut
' connect to the registry on the specified computer
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
StdOut.WriteLine "Changing Registry on " & strComputer
' registry key we want to modify
strKeyPath = "SOFTWARE\MyCompany\"
' create a new key.
' strKeyPath = "SOFTWARE\MyCompany\New registry folder"
' oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
' write a string value
strValueName = "String Value Name"
strValue = "string value"
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
' write a integer value
strValueName = "DWORD Value Name"
dwValue = 82
oReg.SetDWORDValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,dwValue
Solution 3:
According to MS KB831787 Prevent Access to Registry Editing Tools policy changes in Windows XP and in Windows Server 2003 you can run regedit in silent mode, even on Windows XP/2003, if you update a GPO template.
From KB831787,
A new feature is available to change the way that Microsoft Windows XP and Microsoft Windows Server 2003 uses the Prevent Access to Registry Editing Tools policy. With this feature, you can configure a registry setting so that you can use one of the following configurations:
- Registry Editor can be started either in interactive mode or in silent mode.
- Registry Editor can be started only in silent mode (regedit /s). This is the default behavior in Windows 2000 and in Windows NT 4.0 when the Prevent Access to Registry Editing Tools policy is applied.
- Registry Editor cannot be started at all. This is the default behavior in Windows XP when the Prevent Access to Registry Editing Tools policy is applied.