GroupPolicyObject.DeleteValue Method (RegistryHive, String, String)

 

Deletes the registry-based policy setting for a registry value from the Group Policy object (GPO).

Namespace:   Microsoft.GroupPolicy
Assembly:  Microsoft.GroupPolicy.Management.Interop (in Microsoft.GroupPolicy.Management.Interop.dll)

Syntax

public void DeleteValue(
    RegistryHive hive,
    string keyPath,
    string valueName
)
public:
void DeleteValue(
    RegistryHive hive,
    String^ keyPath,
    String^ valueName
)
member DeleteValue : 
        hive:RegistryHive *
        keyPath:string *
        valueName:string -> unit
Public Sub DeleteValue (
    hive As RegistryHive,
    keyPath As String,
    valueName As String
)

Parameters

  • hive
    Type: Microsoft.Win32.RegistryHive

    One of the RegistryHive values that specifies the registry hive for which to delete the registry-based policy setting. Specify CurrentUser to delete the policy setting from User Configuration. Specify LocalMachine to delete the policy setting from Computer Configuration. No other values are supported.

  • keyPath
    Type: System.String

    The path to the registry key for which to delete the registry-based policy setting.

  • valueName
    Type: System.String

    The name of the value for which to delete the registry-based policy setting. Specify an empty string (“”) for the default value.

Exceptions

Exception Condition
ArgumentException

A registry-based policy setting does not exist for the specified registry value.

ArgumentNullException

The keyPath parameter or the valueName parameter is null.

ArgumentOutOfRangeException

hive is not a supported RegistryHive value.

ObjectDisposedException

The GroupPolicyObject is disposed.

Remarks

The registry key for which to delete the registry-based policy setting is specified by a combination of the hive and the keyPath parameters.

See Also

GroupPolicyObject Class
Microsoft.GroupPolicy Namespace

Return to top