GroupPolicyObject.GetRegistrySetting Method (RegistryHive, String, String)

 

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

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

Syntax

public PolicyRegistrySetting GetRegistrySetting(
    RegistryHive hive,
    string keyPath,
    string valueName
)
public:
PolicyRegistrySetting^ GetRegistrySetting(
    RegistryHive hive,
    String^ keyPath,
    String^ valueName
)
member GetRegistrySetting : 
        hive:RegistryHive *
        keyPath:string *
        valueName:string -> PolicyRegistrySetting
Public Function GetRegistrySetting (
    hive As RegistryHive,
    keyPath As String,
    valueName As String
) As PolicyRegistrySetting

Parameters

  • hive
    Type: Microsoft.Win32.RegistryHive

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

  • keyPath
    Type: System.String

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

  • valueName
    Type: System.String

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

Return Value

Type: Microsoft.GroupPolicy.PolicyRegistrySetting

Returns PolicyRegistrySetting. The registry-based policy setting.

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