COMMAND EVERYTHING.
Configures a Registry preference item under either Computer Configuration or User Configuration in a GPO.
Microsoft GroupPolicy reference: Configures a Registry preference item under either Computer Configuration or User Configuration in a GPO. The syntax and selected example below are adapted from the pinned Windows Server 2025 reference. Module availability, target configuration and delegated permissions determine whether it can run in your environment. Documentation and parameter text: Microsoft, CC BY 4.0; formatting adapted by Cmdlet World. No execution testing is claimed.
Use an account with the target resource permissions documented for Set-GPPrefRegistryValue. Modifying administrative cmdlets may require elevation or delegated administration. This catalog does not assert that ordinary users can execute the command.
Windows / GroupPolicy · Windows Server 2025 documentation; feature/module prerequisites apply
-Action (required)- Specifies the action for the Registry preference item. The acceptable values for this parameter are: - Create - Update - Replace - Delete The action specifies how the Registry preference item is applied to the registry key or registry value on the client when Group Policy is processed.
-Confirm- Prompts you for confirmation before running the cmdlet.
-Context (required)- Specifies whether the Registry preference item is configured under User Configuration or Computer Configuration in the GPO. The acceptable values for this parameter are: User or Computer.
-Disable- Indicates that the cmdlet configures the Registry preference item as disabled. A disabled Registry preference item is not applied when Group Policy is processed on the client, and, therefore, does not modify any existing registry keys or values on the client. This parameter does not disable an existing Registry preference item in the GPO, rather, it creates a new Registry preference item that is disabled. Any existing Registry preference items that configure the same key or value will still be applied when the GPO is processed on a client. This behavior is different than disabling an existing Registry preference item using the GPMC. You can use the Remove-GPPrefRegistryValue cmdlet to remove any existing Registry preference items associated with the specified key or value from the appropriate configuration (User or Computer) in the GPO before you create the new disabled Registry preference item. This ensures that after you create the disabled Registry preference item, it will be the only Registry preference item associated with the key or value in the specified configuration in the GPO.
-Domain- Specifies the domain for this cmdlet. You must specify the fully qualified domain name (FQDN) of the domain. For the Set-GPPrefRegistryValue cmdlet, the GPO for which to configure the Registry preference item must exist in this domain. If you do not specify the Domain parameter, the domain of the user that is running the current session is used. If the cmdlet is being run from a computer startup or shutdown script, the domain of the computer is used. For more information, see the Notes section in the full Help. If you specify a domain that is different from the domain of the user that is running the current session (or, for a startup or shutdown script, the computer), a trust must exist between that domain and the domain of the user or the computer. You can also refer to the Domain parameter by its built-in alias, DomainName. For more information, see about_Aliases.
-Guid (required)- Specifies the GPO in which to configure the Registry preference item by its globally unique identifier (GUID). The GUID uniquely identifies the GPO. You can also refer to the Guid parameter by its built-in alias, Id.
-Key (required)- Specifies the registry key for the Registry preference item; for instance: HKEY_CURRENT_USER\Control Panel\Colors. You can specify any of the following registry hives: HKEY_CLASSES_ROOT (HKCR), HKEY_CURRENT_USER (HKCU), HKEY_LOCAL_MACHINE (HKLM), HKEY_USERS (HKU), and HKEY_CURRENT_CONFIG (HKCC). Any of these hives can be specified for Registry preference items in both Computer Configuration and User Configuration. You can configure a preference registry setting for a registry key or a registry value. - To configure a setting for a registry key, specify the Key parameter without the *ValueName*, Value, or Type parameters. - To configure a setting for a registry value, specify the Key parameter together with the ValueName, Value, and Type parameters.
-Name (required)- Specifies the GPO in which to configure the Registry preference item by its display name. The display name is not guaranteed to be unique in the domain. If another GPO with the same display name exists in the domain, an error occurs. You can use the Guid parameter to uniquely identify a GPO. You can also refer to the Name parameter by its built-in alias, DisplayName.
-Order- Specifies the order in which the Registry preference item is processed relative to other Registry preference items in the GPO when the GPO is applied on a client computer. If two Registry preference items in the GPO change the same registry value, the one that has the highest order is the last to modify the value on the client. By default, if the Order parameter is not specified, the order is set to one plus the current number of Registry preference items in the GPO. You can specify any value greater than zero. If you specify a value larger than the default value, the order is set to the default. The order of a setting can change as Registry preference items are added or removed from the GPO. For instance, if the GPO has five Registry preference items, and you add another one and specify an order of 4, the Registry preference items that previously were at order 4 and 5, are at order 5 and 6 after the change.
-Server- Specifies the name of the domain controller that this cmdlet contacts to complete the operation. You can specify either the fully qualified domain name (FQDN) or the host name. If you do not specify the name by using the Server parameter, the primary domain controller (PDC) emulator is contacted. You can also refer to the Server parameter by its built-in alias, DC.
-Type- Specifies the data type of the registry value for the Registry preference item. The acceptable values for this parameter are: - String - ExpandString - Binary - DWord - MultiString - ExpandString - Qword For more information about these data types, see Microsoft.Win32.RegistryValueKind Enumeration in the MSDN library. When you configure a Registry preference item for a registry key, do not specify this parameter. When you configure a Registry preference item for a registry value, specify this parameter together with the Key, ValueName, and Value parameters.
-Value- Specifies the value data of the registry value for the Registry preference item. For instance, the registry value HKEY_CURRENT_USER\Control Panel\Colors ActiveTitle can have the following (value) data: 10 36 106. When you configure a Registry preference item for a registry key, do not specify this parameter. When you configure a Registry preference item for a registry value, specify this parameter together with the Key, ValueName, and Type parameters.
-ValueName- Specifies the value name of the registry value for the Registry preference item. For instance, the registry key HKEY_CURRENT_USER\Control Panel\Colors can have a value with the following name: ActiveTitle. For the default value of a registry key, specify either (default) or an empty string "". When you configure a Registry preference item for a registry key, do not specify this parameter. When you configure a Registry preference item for a registry value, specify this parameter together with the Key, Value, and Type parameters.
-WhatIf- Shows what would happen if the cmdlet runs. The cmdlet is not run.
Windows with the GroupPolicy module and the Windows feature or management tools that provide it. Confirm target connectivity and version compatibility using the linked Microsoft reference.
This cmdlet changes system state. Review every target and parameter in the official reference, test outside production, and prepare an appropriate backup or rollback. Do not execute the example automatically.