Registry - HKU for all users

NachitoMax 411 Reputation points
2022-09-01T14:53:49.037+00:00

Hey there!

I am trying to do 2 things, hopefully there is a solution.

Summary
My application requires a set of registry keys. I need to add these keys so that they are available for all users existing & future. I know that i need to refer to HKU instead of HKCU.

  1. Existing users
    Here i am trying to loop through the existing users while ignoring the built-in accounts. I can loop add the required registry keys. This means that when an existing user logs on to machine, the registry keys can be read using HKCU.
  2. New Users
    The method about only works for existing users so i need to allow for future users. To do this, i need to load the Default hive, add the registry keys to the Default hive then unload the hive.

Issues
Issue#1 - When i loop through the SIDs, i can successfully identify each one but when i add the registry keys & values, it only occurs on the current user and skips the others.
Issue#2 - If the user is not admin, the registry SIDs cannot be accessed.
Issue#3 - If the user is not admin, the HKU\Default hive cannot be loaded.

I feel that there must be a way around because other applications that are installed in a user environment (not admin) can access the Default hive and other user hives. My streamdeck for example was installed at user level but when i create a new test user, pops up ready for a new user setup and there registry keys and values are in HKU\Default

Questions

  1. Am i able to override the permissions at user level? If so, how?
  2. Is there an alternative method to what i am doing?

My installer application allows me to run a cmd or vbs file so im using one of these 2 methods. I can also move this to my application RunFirstTime class in vb.net if it makes a better solution.

Note:
I am not trying to add the registry keys to .Default as that is not the NTUSER default template, the hine HKU\Default needs to be loaded from C:/Users/Default/NTUSER.DAT and then registry keys added to that.

Thanks

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,369 questions
.NET Runtime
.NET Runtime
.NET: Microsoft Technologies based on the .NET software framework.Runtime: An environment required to run apps that aren't compiled to machine language.
1,119 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 55,686 Reputation points
    2022-09-01T15:52:18.223+00:00

    at install you can only update the current user (the other hives are not loaded).

    most apps ask if you want setting for all, or current. if all, then they are stored at the app level, not the user. its common to let the user override the app settings with values in local app data, To add registry settings, the install app needs admin permission. to use users have for settings, each user must run the install app (to get the admin permissions to create the register entries.

    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. NachitoMax 411 Reputation points
    2022-09-01T17:23:28.357+00:00

    Hi

    thought as much. im never going to get IT to allow any permissions so i'll look for an alternative on a new thread :)

    Thanks

    0 comments No comments

  2. NachitoMax 411 Reputation points
    2022-09-02T04:01:50.71+00:00

    Hey

    i added a registry class to my application that checks for registry values at user level and adds them to the registry if they dont exist. This seems to work ok without the pain of trying to add or work with IT for permissions.

    Thanks again

    0 comments No comments