GroupPolicyObject.GetRegistrySettings Method (RegistryHive, String)

 

Retrieves 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 ReadOnlyCollection<RegistryItem> GetRegistrySettings(
    RegistryHive hive,
    string keyPath
)
public:
ReadOnlyCollection<RegistryItem^>^ GetRegistrySettings(
    RegistryHive hive,
    String^ keyPath
)
member GetRegistrySettings : 
        hive:RegistryHive *
        keyPath:string -> ReadOnlyCollection<RegistryItem>
Public Function GetRegistrySettings (
    hive As RegistryHive,
    keyPath As String
) As ReadOnlyCollection(Of RegistryItem)

Parameters

  • hive
    Type: Microsoft.Win32.RegistryHive

    One of the RegistryHive values that specifies the registry hive for which to retrieve the registry-based policy settings. Specify CurrentUser to retrieve policy settings from User Configuration. Specify LocalMachine to retrieve policy settings 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 settings.

Return Value

Type: System.Collections.ObjectModel.ReadOnlyCollection<RegistryItem>

Returns ReadOnlyCollection<T>. A read-only collection of PolicyRegistrySetting objects, each of which represents a registry-based policy setting.

Exceptions

Exception Condition
ArgumentException

keyPath is an empty string (“”).

- 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 retrieve registry-based policy settings is specified by a combination of the hive and the keyPath parameters. The method retrieves all registry-based policy settings for the key and its first-level values.

See Also

GroupPolicyObject Class
Microsoft.GroupPolicy Namespace

Return to top