regset

Sets a registry key to the given name and value. If the key doesn't already exist, this command creates the key with this starting value.

Syntax

regset "<registry key>" "<value name>"=<value>

Where registry key is the key of interest and value name is the key value to set to value. These values are entered just as they are in a REGEDIT4 registry file, in keeping with the rules for Regedit, the Windows program that edits the registry. String values are delimited by quotes, and the standard 4-byte integer (dword) is identified using dword: followed by the numeric value entered in hexadecimal (with leading zeroes) as shown below.

Examples

regset "[HKEY_CURRENT_USER\Software\Microsoft\Office\9.1\Word\Security]"
  "Level"=dword:00000002

This example sets the Level value of the specified registry to a double-word 2.

regset "[HKEY_CURRENT_USER\Software\BigCorp Inc.]" "testString"="bob"

This example sets the testString value of the specified registry key to bob.

regset "[HKEY_CLASSES_ROOT\ShellScrap]" "AlwaysShowExt"="" 

This example clears the data of the specified registry value.

Notes

This command is Windows-only. It will cause an action script to terminate on a Unix agent.

Notice in these examples that square brackets [ ] are used to enclose the name of the registry key. Again, this is in keeping with the rules for REGEDIT4 registry files. This syntax is necessary for the RegSet command, but not for registry Inspectors.

When you use the regset command, keep in mind that the IBM BigFix Client dynamically builds the .reg file that you would have had to create manually to update the registry and then it executes that resulting .reg file for you. One of the rules of the .reg file is that any \'s in the value field need to appear as double slashes, that is \\. So if you were trying to assign the value SourcePath2 of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion to c:\I386, the command that you would define would look like this:

regset "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]" 
  "SourcePath2"="c:\\I386"
regset "[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion]" 
  "SourcePath2"={escape of "c:\I386"}

The last example uses the escape relevance clause to automatically convert backslashes to double backslashes.

In situations where you need to issue many regset commands, you might consider using the appendfile or createfile until commands to build a properly formatted regedit file, and then run regedit silently:

Createfile until end-reg-edit-commands
      REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion] 
  "SourcePath1"="c:\\I386"
  "SourcePath2"="{escapes of pathname of windows folder}"
end-reg-edit-commands
move __createfile setup.reg
wait regedit /s setup.reg

If the specified key does not already exist, it will be created by this command.

Version 5.1 and above -- Windows Only