devcrazy
devcrazy

Reputation: 503

finding registry key corresponding to group policy object

I have to edit Local group policy frequently. But it's path is too long to remember. So I want to control by program. They said gp object is the front end of the registry. But How can I find the registry key corresponding to the gp object. Example path is

administrative templates/windows components/remote desktop services/remote desktop session host/device and resource redirection/Do not allow clipboard redirection

Upvotes: 0

Views: 85

Answers (1)

Athanasios Kataras
Athanasios Kataras

Reputation: 26372

You can use the Registry.SetValue function.

Example:

        const string userRoot = "HKEY_CURRENT_USER";
        const string subkey = "RegistrySetValueExample";
        const string keyName = userRoot + "\\" + subkey;

        // An int value can be stored without specifying the
        // registry data type, but long values will be stored
        // as strings unless you specify the type. Note that
        // the int is stored in the default name/value
        // pair.
        Registry.SetValue(keyName, "", 5280);
        Registry.SetValue(keyName, "TestLong", 12345678901234,
            RegistryValueKind.QWord);

keyName String

The full registry path of the key, beginning with a valid registry root, such as "HKEY_CURRENT_USER".

Upvotes: 1

Related Questions