# Actions: Registry

install4j BeanInfo catalog. Each entry below documents a bean class that can appear inside a `<serializedBean>` element in an install4j project file.

## Contents

- [Change access rights for a key in the Windows registry](#change-access-rights-for-a-key-in-the-windows-registry) — `com.install4j.runtime.beans.actions.registry.AddRegistryRightsAction`
- [Delete a key or value in the Windows registry](#delete-a-key-or-value-in-the-windows-registry) — `com.install4j.runtime.beans.actions.registry.DeleteRegistryItemAction`
- [Delete a node or key in the Java preference store](#delete-a-node-or-key-in-the-java-preference-store) — `com.install4j.runtime.beans.actions.registry.DeletePreferenceItemAction`
- [Load installer variables from the Java preference store](#load-installer-variables-from-the-java-preference-store) — `com.install4j.runtime.beans.actions.registry.LoadInstallerVariablesAction`
- [Read a key from the Java preference store](#read-a-key-from-the-java-preference-store) — `com.install4j.runtime.beans.actions.registry.ReadPreferenceKeyAction`
- [Read a value from the Windows registry](#read-a-value-from-the-windows-registry) — `com.install4j.runtime.beans.actions.registry.ReadRegistryValueAction`
- [Save installer variables to the Java preference store](#save-installer-variables-to-the-java-preference-store) — `com.install4j.runtime.beans.actions.registry.SaveInstallerVariablesAction`
- [Set a key in the Java preference store](#set-a-key-in-the-java-preference-store) — `com.install4j.runtime.beans.actions.registry.SetPreferenceKeyAction`
- [Set a value in the Windows registry](#set-a-value-in-the-windows-registry) — `com.install4j.runtime.beans.actions.registry.SetRegistryValueAction`

---

### Change access rights for a key in the Windows registry
- **Class:** `com.install4j.runtime.beans.actions.registry.AddRegistryRightsAction`
- **Category:** Windows registry
- **Multiple instances:** yes

Changes access rights for a key in the Windows registry.If a helper process with elevated privileges has been created by the "Request privileges" action, this action is pushed to the helper process. Please see the help topic on "Elevation Of Privileges" for more information.

| Property | Type | Category | Visible when | Description |
|---|---|---|---|---|
| `registryRoot` — Registry root | [RegistryRoot](enums.md#registryroot) | Configuration | — | The Windows registry root where the key is located. |
| `keyName` — Key name | String | Configuration | — | The name of the registry key without a leading backslash. |
| `accessMode` — Access mode | [AccessMode](enums.md#accessmode) | Configuration | — | The access change mode.Grant access: Combines the specified rights with existing rights for the trustee.Set access: Set only the specified rights for the trustee.Deny access: Combine the specified rights with existing "deny" entries for the trustee.Revoke access: Remove all existing rights for the trustee. Note that this mode only deletes existing non-inherited "allow" entries for the trustee. To prevent access, use the "Deny access" mode instead. |
| `group` — Trustee | [WindowsGroup](enums.md#windowsgroup) | Rights | — | The trustee for which the access right should be changed. Specifies the user or group to which the file system rights should apply. The available options are: Authenticated users All users that have successfully logged on to the system. This excludes anonymous or guest sessions. This is equivalent to the Windows built-in group Authenticated Users. World All users, including guests and anonymous users. This corresponds to the Windows Everyone group. Administrators The built-in Windows group Administrators. Users The built-in Windows group Users, which includes all standard non-privileged users. Guests The built-in Windows group Guests, typically used for limited access accounts. Original User The user who originally started the installer process. This is relevant if the installer includes a "Request privileges" action and the "Action elevation type" property of this action is set to "Elevate to maximum available privileges". SID or Account Name Allows specifying a custom security identifier (SID) or account name manually in a separate child property. Use this for advanced use cases requiring access control for specific accounts or domain users. |
| `sidOrAccountName` — SID or Account Name | String | Rights | `group`=SID or Account Name | The SID in String form or the account name for which the access right should be changed. |
| `read` — Read | boolean | Rights | — | The right to read the object. |
| `write` — Write | boolean | Rights | — | The right to write to the object. |
| `execute` — Execute | boolean | Rights | — | The right to execute the object. |
| `all` — All | boolean | Rights | — | All available rights. |

### Delete a key or value in the Windows registry
- **Class:** `com.install4j.runtime.beans.actions.registry.DeleteRegistryItemAction`
- **Category:** Windows registry
- **Multiple instances:** yes

Delete a key or value in the Windows registry.

| Property | Type | Category | Visible when | Description |
|---|---|---|---|---|
| `registryRoot` — Registry root | [RegistryRoot](enums.md#registryroot) | Configuration | — | The Windows registry root where the key or value should be deleted. |
| `keyName` — Key name | String | Configuration | — | The name of the registry key that should be deleted or contains the value to be deleted without a leading backslash. |
| `valueName` — Value name | String | Configuration | — | The name of the registry value that should be deleted. If you leave this empty, the key will be deleted instead. |
| `onlyIfEmpty` — Only if empty | boolean | Configuration | — | If a key should only be deleted when it contains no sub-keys or values. |

### Delete a node or key in the Java preference store
- **Class:** `com.install4j.runtime.beans.actions.registry.DeletePreferenceItemAction`
- **Category:** Java preference store
- **Multiple instances:** yes

Delete an entire package node or a key-value pair in the Java preference store.

| Property | Type | Category | Visible when | Description |
|---|---|---|---|---|
| `packageName` — Package name | String | Configuration | — | The name of the package node in the preference store that should be deleted or contains the key-value pair to be deleted. The action does not return an error if this package node does not exist.For your convenience, install4j replaces "." with "/" and "_" with "-" in package names to make it possible to use the package syntax rather than the path syntax. If you do not want these characters to be replaced, you have to prefix them with a backslash, like "\\." |
| `key` — Key | String | Configuration | — | The key that should be deleted. If you leave this empty, the entire package node will be deleted instead. The action does not return an error if this key does not exist. |
| `preferenceDeleteType` — Preference root | [PreferenceDeleteType](enums.md#preferencedeletetype) | Configuration | — | If you want to delete the node or key-value pair for the current user, all users, or both. |
| `onlyIfEmpty` — Only if empty | boolean | Configuration | — | If a node should only be deleted when it contains no sub-nodes or keys. |

### Load installer variables from the Java preference store
- **Class:** `com.install4j.runtime.beans.actions.registry.LoadInstallerVariablesAction`
- **Category:** Java preference store
- **Multiple instances:** yes

Load installer variables from the Java preference store that have been previously saved by the "Save installer variables to the Java preference store" action.

| Property | Type | Category | Visible when | Description |
|---|---|---|---|---|
| `packageName` — Package name | String | Configuration | — | The name of the package node in the preference store where the installer variables should be loaded from. By default, this is set to the application ID.For your convenience, install4j replaces "." with "/" and "_" with "-" in package names to make it possible to use the package syntax rather than the path syntax. If you do not want these characters to be replaced, you have to prefix them with a backslash, like "\\." |
| `preferenceReadType` — Preference root | [PreferenceReadType](enums.md#preferencereadtype) | Configuration | — | If you want to load the installer variables for the current user, all users, or first read the settings for all users and then override with the user-specific settings. |

### Read a key from the Java preference store
- **Class:** `com.install4j.runtime.beans.actions.registry.ReadPreferenceKeyAction`
- **Category:** Java preference store
- **Multiple instances:** yes

Read the value of a key from the Java preference store and save it to an installer variable. Only string values can be read.

| Property | Type | Category | Visible when | Description |
|---|---|---|---|---|
| `packageName` — Package name | String | Configuration | — | The name of the package node in the preference store where the key is located.For your convenience, install4j replaces "." with "/" and "_" with "-" in package names to make it possible to use the package syntax rather than the path syntax. If you do not want these characters to be replaced, you have to prefix them with a backslash, like "\\." |
| `key` — Key | String | Configuration | — | The key whose value should be read. |
| `useDefault` — Use a default value | boolean | Configuration | — | If selected, a default value will be saved to the variable if the key cannot be found in the preference store. Otherwise, a missing key will result in the failure of the action and the variable will not be set. |
| `defaultValue` — Default value | String | Configuration | `useDefault`=true | The default value that will be used if the key cannot be found in the preference store. |
| `preferenceReadType` — Preference root | [PreferenceReadType](enums.md#preferencereadtype) | Configuration | — | If you want to read the value of the key for the current user, all users, or first read the settings for all users and then override with the user-specific settings. |
| `variableName` — Variable name | String [context=variableName] (variable→ String) | Configuration | — | The name of the variable that will be set with the string value. Enter the variable without the installer prefix and the dollar sign. If the key cannot be found in the preference store, the variable value will not be set. |

### Read a value from the Windows registry
- **Class:** `com.install4j.runtime.beans.actions.registry.ReadRegistryValueAction`
- **Category:** Windows registry
- **Multiple instances:** yes

Read a value from the Windows registry and save it to an installer variable. The type of the value depends on the type in the registry, it will be an instance of one of the following classes: String, Integer, String[], byte[], WinRegistry.ExpandString.

| Property | Type | Category | Visible when | Description |
|---|---|---|---|---|
| `registryRoot` — Registry root | [RegistryRoot](enums.md#registryroot) | Configuration | — | The Windows registry root where the key is located. |
| `keyName` — Key name | String | Configuration | — | The name of the registry key where the value is located without a leading backslash. |
| `valueName` — Value name | String | Configuration | — | The name of the registry value whose string content should be read. |
| `useDefault` — Use a default value | boolean | Configuration | — | If selected, a default value will be saved to the variable if the key cannot be found in the registry. Otherwise, a missing registry value will result in the failure of the action and the variable will not be set. |
| `defaultValue` — Default value | String | Configuration | `useDefault`=true | The default value that will be used if the value cannot be found in the registry. |
| `variableName` — Variable name | String [context=variableName] | Configuration | — | The name of the variable that will be set with the value. Enter the variable without the installer prefix and the dollar sign. If the value cannot be found in the registry, the variable value will not be set. |

### Save installer variables to the Java preference store
- **Class:** `com.install4j.runtime.beans.actions.registry.SaveInstallerVariablesAction`
- **Category:** Java preference store
- **Multiple instances:** yes

Save installer variables to the Java preference store. This can be used to communicate installer variables to the uninstaller or to installers with different application IDs.

| Property | Type | Category | Visible when | Description |
|---|---|---|---|---|
| `packageName` — Package name | String | Configuration | — | The name of the package node in the preference store where the installer variables should be set. By default, this is set to the application ID.For your convenience, install4j replaces "." with "/" and "_" with "-" in package names to make it possible to use the package syntax rather than the path syntax. If you do not want these characters to be replaced, you have to prefix them with a backslash, like "\\." |
| `preferenceWriteType` — Preference root | [PreferenceWriteType](enums.md#preferencewritetype) | Configuration | — | If you want to save the installer variables for the current user only or for all users. Due to access rights it can happen that the system preference registry is not writable, in that case a fallback to the user-specific registry can be tried. |
| `installerVariables` — Installer variable names | String[] | Configuration | — | A list of installer variable names. Just enter the names of the installer variables, not including the surrounding ${installer:...} syntax used for variable substitution in text fields. Variables with value null will be ignored. In the edit dialog, you have to enter one item per line. Entries that are installer variables with array or collection values (e.g. String[], Object[] or List<File>) are expanded as separate entries, this allows you to build a variable length list of entries at runtime. |

### Set a key in the Java preference store
- **Class:** `com.install4j.runtime.beans.actions.registry.SetPreferenceKeyAction`
- **Category:** Java preference store
- **Multiple instances:** yes

Set a key-value pair in the Java preference store. The package node is created if necessary. This is the most convenient way to communicate settings to related installers. Only string values can be set.

| Property | Type | Category | Visible when | Description |
|---|---|---|---|---|
| `packageName` — Package name | String | Configuration | — | The name of the package node in the preference store where the key-value pair should be set.For your convenience, install4j replaces "." with "/" and "_" with "-" in package names to make it possible to use the package syntax rather than the path syntax. If you do not want these characters to be replaced, you have to prefix them with a backslash, like "\\." |
| `key` — Key | String | Configuration | — | The key for which a value should be set. |
| `value` — Value | String | Configuration | — | The string value that should be set for the key. |
| `preferenceWriteType` — Preference root | [PreferenceWriteType](enums.md#preferencewritetype) | Configuration | — | If you want to set the key for the current user only or for all users. Due to access rights it can happen that the system preference registry is not writable, in that case a fallback to the user-specific registry can be tried. |

### Set a value in the Windows registry
- **Class:** `com.install4j.runtime.beans.actions.registry.SetRegistryValueAction`
- **Category:** Windows registry
- **Multiple instances:** yes

Set a value in the Windows registry. This action can also create the appropriate key if necessary.

| Property | Type | Category | Visible when | Description |
|---|---|---|---|---|
| `registryRoot` — Registry root | [RegistryRoot](enums.md#registryroot) | Configuration | — | The Windows registry root where the key should be created |
| `keyName` — Key name | String | Configuration | — | The name of the registry key that contains the value or that should be created without a leading backslash. |
| `valueName` — Value name | String | Configuration | — | The name of the registry value. |
| `value` — Value | String | Configuration | — | The value that should be written into the registry. |
| `createKey` — Create key | boolean | Configuration | — | If set the key will be created if it doesn't exist. |

