Jump to content

Recommended Posts

Posted

I have been looking for a way to script changing individual settings in the local group policy under Windows XP Pro. I found a tool called snapreg.exe in the Windows Media Player Enterprise Deployment Kit available at http://www.microsoft.com/windows/windowsme...deploypack.aspx.

snapreg.exe correctly updates the registry.pol and gpt.ini files under %SystemRoot%\System32\GroupPolicy and the local group policy. It has however one shortcoming: it does not seem to be able to delete a setting from the local group policy files, only change its value once set.

Are there any other tools or perhaps a COM object available for scripting that can be used to add, change and delete entries in the local group policy?

By the way, here is the documentation for snapreg.exe:

Documentation for snapreg

-------------------------

Snapreg.exe is a utility for changing local Group Policy settings and

adding registry keys.

Note: It does not simply change the policy settings in the registry

but also updates or creates the Group Policy files in

%SystemRoot%\System32\GroupPolicy.

Download

--------

Snapreg.exe is included in the Windows Media Player Enterprise

Deployment Kit which can be downloaded from:

http://www.microsoft.com/windows/windowsmedia/download/

Despite its lack of documentation it is extremely useful for changing

local Group Policy settings.

Usage:

------

snapreg.exe ( /GetInfo | /SetInfo)

/GetInfo: reads registry and policy information listed in

      regkey.ini from local machine and writes values to

      regkey.txt and policy.txt respectively.

      If regkey.txt is missing from the current

      directory no action will be taken by snapreg.

/SetInfo: reads policy.txt and regkey.txt from current

      directory and applies the values to local group

      policy and local registry respecitvely.

Note: command line options are case sensitive.

regkey.ini

==========

regkey.ini is used by the /SetInfo mode of snapreg to generate

regkey.txt and policy.txt.

The format of regkey.ini is:

-------- snip --------------------

[Keys]

HKCU,Software\Myprogram\Keypath,ValueName

HKLM,Software\Myprogram\Keypath,ValueName

[Policies]

HKLM,Software\Policies\Company\Program,PolicySetting

HKCU,Software\Policies\Company\Program,PolicySetting

-------- snip --------------------

regkey.txt

==========

regkey.txt lists registry values which snapreg should set when called

with /SetInfo.

The format of regkey.txt is:

-------- snip --------------------

HKCU,Software\Myprogram\Keypath,ValueName,0x00010001,0

HKLM,Software\Myprogram\Keypath,ValueName,,"string value"

-------- snip --------------------

The first value above is a REG_DWORD value, indicated by

the 0x00010001 tag. The value is given in decimal notation.

The second value is a REG_SZ value.

policy.txt

==========

Policy.txt uses the same format for describing entries as regkey.txt

but only applies to local Group Policy.

-------- snip --------------------

[Policies]

HKLM,Software\Policies\Company\Program,PolicySetting,0x00010001,0

HKCU,Software\Policies\Company\Program,PolicySetting,,"string value"

HKLM,Software\Microsoft\Windows\CurrentVersion\policies,PolicySetting,0x00010001,1

HKCU,Software\Microsoft\Windows\CurrentVersion\policies,PolicySetting,,"string value"

-------- snip --------------------


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...