GroupPolicyObject.DeleteAllValues Method (RegistryHive, String)

 

Deletes the registry-based policy settings for a registry key and all its values from the Group Policy object (GPO).

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

Syntax

public void DeleteAllValues(
    RegistryHive hive,
    string keyPath
)
public:
void DeleteAllValues(
    RegistryHive hive,
    String^ keyPath
)
member DeleteAllValues : 
        hive:RegistryHive *
        keyPath:string -> unit
Public Sub DeleteAllValues (
    hive As RegistryHive,
    keyPath 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 settings. Specify CurrentUser to delete policy settings from User Configuration. Specify LocalMachine to delete policy settings 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 settings.

Exceptions

Exception Condition
ArgumentException

keyPath is an empty string (“”).

- or -

Registry-based policy settings exist for subkeys of the specified registry key.

- or -

No registry-based policy settings exist for the specified registry key or its values.

ArgumentNullException

keyPath is null.

ArgumentOutOfRangeException

hive is not a supported RegistryHive value.

ObjectDisposedException

The GroupPolicyObject is disposed.

Remarks

The registry key for which to delete registry-based policy settings is specified by a combination of the hive and the keyPath parameters. The method deletes all registry-based policy settings for the key and its first-level values. If registry-based policy settings exist for subkeys of the specified key, the method fails and an exception is thrown. In this case, no registry-based policy settings are deleted.

See Also

GroupPolicyObject Class
Microsoft.GroupPolicy Namespace

Return to top