Remove-GPPrefRegistryValue

Remove-GPPrefRegistryValue

Removes one or more Registry preference items from either Computer Configuration or User Configuration in a GPO.

Sintaxis

Parameter Set: GetByGUID
Remove-GPPrefRegistryValue [[-Server] <String> ] -Context <GpoConfiguration> -Guid <Guid> -Key <String> [-Domain <String> ] [-Order <Int32> ] [-ValueName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: GetByName
Remove-GPPrefRegistryValue [-Name] <String> [[-Server] <String> ] -Context <GpoConfiguration> -Key <String> [-Domain <String> ] [-Order <Int32> ] [-ValueName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Descripción detallada

The Remove-GPPrefRegistryValue cmdlet removes one or more Registry preference items from either Computer Configuration or User Configuration in a GPO. You must specify the Context parameter (User or Computer) to indicate whether to remove the Registry preference item from Computer Configuration or User Configuration. . You can specify the GPO by its display name or by its GUID.

You can specify either a key or a value:

--If you specify a key, all Registry preference items that configure that registry key or any of its (first-level) values are removed from the specified configuration in the GPO. Registry preference items that configure subkeys of that key (or their values) are not affected. For a key, specify the Key parameter without the ValueName parameter.

--If you specify a value, all Registry preference items that configure that registry value are removed from the specified configuration in the GPO. For a value, specify the Key parameter without the ValueName parameter.

This cmdlet can take input from the pipeline:

--You can pipe GPO objects to this cmdlet to remove a specified Registry preference item from one or more GPOs.

--You can pipe PreferencRegistrySetting objects to this cmdlet to remove one or more Registry preference items from a specified GPO.

Parámetros

-Context<GpoConfiguration>

Specifies whether the Registry preference item (or items) are removed from Computer Configuration or User Configuration in the specified GPO. You must specify either User or Computer.

The following values are permitted for this object type.

Alias

ninguno

¿Requerido?

true

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-Domain<String>

Specifies the domain for this cmdlet. You must specify the fully qualified domain name (FQDN) of the domain (for example: sales.contoso.com).

For the Remove-GPPrefRegistryValue cmdlet, the GPO from which to remove the Registry preference item (or items) 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.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

true (ByPropertyName)

¿Aceptar caracteres comodín?

false

-Guid<Guid>

Specifies the GPO from which to remove 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". For more information, see about_Aliases.

Alias

ninguno

¿Requerido?

true

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

true (ByPropertyName)

¿Aceptar caracteres comodín?

false

-Key<String>

Specifies a registry key for which to remove one or more Registry preference items; for example, "HKCU\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.

The Key parameter can be specified with or without the ValueName parameter:

--If the ValueName parameter is specified, all Registry preference items that configure the registry value are removed.

--If the ValueName parameter is not specified, all Registry preference items that configure the registry key and any of its (first-level) values are removed.

You can also refer to the Key parameter by its built-in alias, "FullKeyPath". For more information, see about_Aliases.

Alias

ninguno

¿Requerido?

true

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

true (ByPropertyName)

¿Aceptar caracteres comodín?

false

-Name<String>

Specifies the GPO from which to remove 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". For more information, see about_Aliases.

Alias

ninguno

¿Requerido?

true

¿Posición?

1

Valor predeterminado

ninguno

¿Aceptar canalización?

true (ByValue)

¿Aceptar caracteres comodín?

false

-Order<Int32>

Specifies the order in which a Registry preference item is processed relative to other Registry preference items in the GPO when the GPO is applied on a client computer.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

true (ByPropertyName)

¿Aceptar caracteres comodín?

false

-Server<String>

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. For example:

FQDN: DomainController1.sales.contoso.com

Host Name: DomainController1

If you do not specify the name by using the Server parameter, the PDC emulator is contacted.

You can also refer to the Server parameter by its built-in alias, "dc". For more information, see about_Aliases.

Alias

ninguno

¿Requerido?

false

¿Posición?

7

Valor predeterminado

ninguno

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-ValueName<String>

Specifies the name of a registry value for which to remove all Registry preference items. If you specify the ValueName parameter, you must also specify the Key parameter.

Alias

ninguno

¿Requerido?

false

¿Posición?

named

Valor predeterminado

ninguno

¿Aceptar canalización?

true (ByPropertyName)

¿Aceptar caracteres comodín?

false

-Confirm

Solicita confirmación antes de ejecutar el cmdlet.

¿Requerido?

false

¿Posición?

named

Valor predeterminado

falso

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

-WhatIf

Muestra lo que sucedería si se ejecutara el cmdlet. El cmdlet no se ejecuta.

¿Requerido?

false

¿Posición?

named

Valor predeterminado

falso

¿Aceptar canalización?

false

¿Aceptar caracteres comodín?

false

<CommonParameters>

Este cmdlet admite los siguientes parámetros comunes: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer y -OutVariable. Para obtener más información, consulte about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Entradas

El tipo de entrada es el tipo de los objetos que se pueden canalizar al cmdlet.

  • Microsoft.GroupPolicy.Gpo, Microsoft.GroupPolicy.PreferenceRegistrySetting

    This cmdlet takes a GPO or a PreferenceRegistrySetting object as input. You can pipe in one or more PreferenceRegistrySetting objects (for example, from Get-GPPrefRegistryValue) to remove one or more Registry preference items from a specified GPO. You can pipe in one or more GPO objects (for example, from Get-GPO) to remove a specified Registry preference item from each GPO. Collections that contain GPOs from different domains are not supported.

Salidas

El tipo de resultado es el tipo de objetos que emite el cmdlet.

  • Microsoft.GroupPolicy.Gpo

    Remove-GPPrefRegistryValue returns the GPO from which the Registry preference item (or items) has been removed.

Notas

  • You can use the Domain parameter to explicitly specify the domain for this cmdlet.

    If you do not explicitly specify the domain, the cmdlet uses a default domain. The default domain is the domain that is used to access network resources by the security context under which the current session is running. This domain is typically the domain of the user that is running the session. For example, the domain of the user who started the session by opening Windows PowerShell from the Program Files menu, or the domain of a user that is specified in a runas command. However, computer startup and shutdown scripts run under the context of the LocalSystem account. The LocalSystem account is a built-in local account, and it accesses network resources under the context of the computer account. Therefore, when this cmdlet is run from a startup or shutdown script, the default domain is the domain to which the computer is joined.

Ejemplos

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

Description

-----------

This command removes all Registry preference items that configure the registry value "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExampleKey ValueOne" from User Configuration in the "TestGPO" GPO.

PS C:\> Remove-GPPrefRegistryValue -Name TestGPO -Context User -Key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExampleKey" -ValueName ValueOne 

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

Description

-----------

This command removes Registry preference items that configure any (first-level) values under the registry key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExampleKey" or the key itself from Computer Configuration in the "TestGPO" GPO.

PS C:\> Remove-GPPrefRegistryValue -Name TestGPO -Context Computer -Key "HKLM\SOFTWARE\Microsoft\ExampleKey" 

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

Description

-----------

This command removes any Registry preference items that configure the registry value "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExampleKey ValueOne" from User Configuration for all GPOs in the domain. It returns each GPO from which at least one Registry preference item is removed.

Note: The Remove-GPPrefRegistryValue returns a non-terminating error for each GPO that does not have a Registry preference item associated with the specified registry value. In this command, these error messages are suppressed by setting the ErrorAction parameter to SilentlyContinue (-ErrorAction SilentlyContinue). For more information about the ErrorAction parameter, see about_CommonParameters.

PS C:\> Get-GPO -All | Remove-GPPrefRegistryValue -Context User -Key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ExampleKey" -ValueName ValueOne -ErrorAction SilentlyContinue 

Temas relacionados

Get-GPPrefRegistryValue

Set-GPPrefRegistryValue