lexicon Posted July 25, 2004 Posted July 25, 2004 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 andadding registry keys.Note: It does not simply change the policy settings in the registrybut also updates or creates the Group Policy files in%SystemRoot%\System32\GroupPolicy.Download--------Snapreg.exe is included in the Windows Media Player EnterpriseDeployment Kit which can be downloaded from:http://www.microsoft.com/windows/windowsmedia/download/Despite its lack of documentation it is extremely useful for changinglocal 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 generateregkey.txt and policy.txt.The format of regkey.ini is:-------- snip --------------------[Keys]HKCU,Software\Myprogram\Keypath,ValueNameHKLM,Software\Myprogram\Keypath,ValueName[Policies]HKLM,Software\Policies\Company\Program,PolicySettingHKCU,Software\Policies\Company\Program,PolicySetting-------- snip --------------------regkey.txt==========regkey.txt lists registry values which snapreg should set when calledwith /SetInfo.The format of regkey.txt is:-------- snip --------------------HKCU,Software\Myprogram\Keypath,ValueName,0x00010001,0HKLM,Software\Myprogram\Keypath,ValueName,,"string value"-------- snip --------------------The first value above is a REG_DWORD value, indicated bythe 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.txtbut only applies to local Group Policy.-------- snip --------------------[Policies]HKLM,Software\Policies\Company\Program,PolicySetting,0x00010001,0HKCU,Software\Policies\Company\Program,PolicySetting,,"string value"HKLM,Software\Microsoft\Windows\CurrentVersion\policies,PolicySetting,0x00010001,1HKCU,Software\Microsoft\Windows\CurrentVersion\policies,PolicySetting,,"string value"-------- snip --------------------
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now