PowerShell Logo Small

Set-GPRegistryValue



This is the built-in help made by Microsoft for the command 'Set-GPRegistryValue', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Configures one or more registry-based policy settings under either Computer Configuration or User Configuration in a GPO.

SYNTAX


Set-GPRegistryValue [-Additive [<SwitchParameter>]] [-Disable [<SwitchParameter>]] [-Domain <String>] [-Server <String>] [-Type
<RegistryValueKind>] [-Value <PSObject>] [-ValueName <String[]>] [-ValuePrefix <String>] -Guid <Guid> -Key <String> [<CommonParameters>]
Set-GPRegistryValue [-Name] <String> [-Additive [<SwitchParameter>]] [-Disable [<SwitchParameter>]] [-Domain <String>] [-Server <String>]
[-Type <RegistryValueKind>] [-Value <PSObject>] [-ValueName <String[]>] [-ValuePrefix <String>] -Key <String> [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Set-GPRegistryValue cmdlet configures a registry-based policy setting under either Computer Configuration or User Configuration in a GPO.
The policy setting configures keys or values in the registry on the client computer when the GPO is applied.


You can specify the GPO by name or by its GUID, or you can pipe a GPO object to the cmdlet. You can also pipe a PolicyRegistrySetting object
(for example, one returned by Get-GPRegistryValue) to the cmdlet.


You can configure registry-based policy settings for:

-- One or more registry values by passing the Key, ValueName, Value, and Type parameters. For multiple registry values, pass a comma-separated
list for both the ValueName and Value parameters. When you specify multiple registry values, only the String and ExpandString data types are
supported.

-- A list of one or more registry values that share the same name prefix by passing the Key and Type parameters, and a single value or a
comma-separated list for the Value parameter. You can optionally specify the value name prefix by using the ValuePrefix parameter. Only the
String and ExpandString data types are supported for lists.


You can use the Additive parameter to ensure that existing registry values for the key are not overwritten by the new policy setting when the
GPO is applied.


You can also delete registry values on a client when the GPO is applied by disabling a policy setting with the Disable parameter. You can
disable:

-- All the registry values under a specified registry key by passing the Key parameter. No subkeys (or their values) will be deleted on the
client.

-- A single registry value by passing the Key parameter and the ValueName parameter.

-- Multiple registry values by passing the Key parameter and a comma-separated list for the ValueName parameter.



<

RELATED LINKS

Get-GPRegistryValue
Remove-GPRegistryValue

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

C:\PS>Set-GPRegistryValue -Name "TestGPO" -key "HKCU\Software\Policies\Microsoft\Windows\Control Panel\Desktop" -ValueName ScreenSaveTimeOut
-Type DWORD -value 900

DisplayName : TestGPO
DomainName : contoso.com
Owner : CONTOSO\Domain Admins
Id : 35c12ab3-956c-45d5-973b-46b17d225f47
GpoStatus : AllSettingsEnabled
Description :
CreationTime : 2/24/2009 4:41:03 PM
ModificationTime : 2/25/2009 12:42:00 PM
UserVersion : AD Version: 3, SysVol Version: 3
ComputerVersion : AD Version: 34, SysVol Version: 34
WmiFilter :



Description

-----------

This command configures a registry-based policy setting for the registry value "HKCU\Software\Policies\Microsoft\Windows\Control
ScreenSaverTimeOut" with a value of 900 and a data type of DWord. This policy setting sets the Screen Saver timeout to 900 seconds (15
minutes) when Group Policy is applied on the client.




-------------------------- EXAMPLE 2 --------------------------

C:\PS>Set-GPRegistryValue -Name "TestGPO" -key "HKCU\Software\Policies\Microsoft\ExampleKey" -ValueName "ValueOne", "ValueTwo", "ValueThree"
-Type String -Value "String 1", "String 2", "String 3"



Description

-----------

This command configures registry-based policy settings to set three registry values. The policy settings are configured in the User
Configuration section of the GPO. When the GPO is applied on the client, the following registry values are set:

"HKCU\Software\Policies\Microsoft\ExampleKey ValueOne" "String 1"

"HKCU\Software\Policies\Microsoft\ExampleKey ValueTwo" "String 2"

"HKCU\Software\Policies\Microsoft\ExampleKey ValueThree" "String 3"




-------------------------- EXAMPLE 3 --------------------------

C:\PS>Set-GPRegistryValue -Name "TestGPO" -key "HKCU\Software\Policies\Microsoft\ExampleKey" -ValuePrefix "MyValue" -Type String -Value
"String 1", "String 2", "String 3"



Description

-----------

This command configures a registry-based policy setting to set a list of three registry values. The policy settings are configured in the
Computer Configuration section of the GPO. Because the Additive parameter is not specified, when the GPO is applied on the client any list
values under the key are deleted -- then, the following registry values are set:

"HKCU\Software\Policies\Microsoft\ExampleKey MyValue1" "String 1"

"HKCU\Software\Policies\Microsoft\ExampleKey MyValue2" "String 2"

"HKCU\Software\Policies\Microsoft\ExampleKey MyValue3" "String 3"

If you specify the Additive parameter, the list values are added to the existing list values on the client when the GPO is applied. (Note: the
actual value names assigned to the list values will depend on the number of existing list values on the client.)




-------------------------- EXAMPLE 4 --------------------------

C:\PS>Set-GPRegistryValue -Disable -Name "TestGPO" -key "HKCU\Software\Policies\Microsoft\ExampleKey" -ValueName "ValueOne", "ValueTwo",
"ValueThree"



Description

-----------

This command disables the registry-based policy settings (in the User Configuration section) for the specified registry values. When the GPO
is applied on the client, the registry values are deleted from the registry on the client.




-------------------------- EXAMPLE 5 --------------------------

C:\PS>Set-GPRegistryValue -Disable -Name "TestGPO" -key "HKCU\Software\Policies\Microsoft\ExampleKey"



Description

-----------

This command disables the registry-based policy setting (in the User Configuration section) for the specified registry key. When the GPO is
applied on the client, all first level values will be deleted from the registry key. Subkeys and their values will not be modified.