environment variable for hkey_users/software

2

Many of my software configurations are stored in theHKEY_USERS\S-1-5-21-2715202203-4090495733-1863141328-1000\Software reg-folder. For developing Portable apps, I want to know the environment variable for S-1-5-21-2715202203-4090495733-1863141328-1000 so that I can dynamically reference it from whichever computer I want.
The above sequence is obviously different for different users.

screenshot of my registry

1: enter image description here

Avi

Posted 2013-11-28T04:05:15.667

Reputation: 242

Answers

0

The keys under HKEY_USERS are SIDs (Security IDentifier). There are some well known SIDs which are the same for all Systems. Microsoft has a document describing these. That same document says that S-1-5-21 are non-unique SIDs. So SIDs beginning with S-1-5-21 are created dynamically and are not the same on different systems.

To make it short: that same registry key will most likely not exist on any other PC you are getting your hands on.

If the registry key is for your own user account, then you can use HKEY_CURRENT_USER. HKEY_CURRENT_USER is a shortcut for your HKEY_USERS\S-1-5-21-... registry key.

If you are not sure what your own SID is, you can get it with whoami /user.

Werner Henze

Posted 2013-11-28T04:05:15.667

Reputation: 4 214

You are right . HKCU and HKU\S-1-5-21.. are the same and so my problem is fixed. btw your MS link points nowhere. Please fix it. – Avi – 2013-11-28T10:58:30.853

@AviAryan Sorry for the wrong link, I fixed that now. – Werner Henze – 2013-11-28T11:47:13.793

-2

To add a missing reg info from an older program that expects the data to be in the HKEY_USERS//Software/ key

You can't create a new SID as contained in the .reg merge file, you cannot create new SIDs regardless of the permissions.

So putting the keys in the existing SID will solve the problem.

Or Just change the SID in the registry file with SID in your system registry editor.

For Ex. You want to merge a registry file contains: [HKEY_USERS\S-1-5-21-1960408961-1202660629-1177238915-1005\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\exe]

The SID in the File is [S-1-5-21-1960408961-1202660629-1177238915-1005]

while the SID in your system registry editor is different

HKEY_USERS\S-1-5-21-1956030832-895603407-332460711-1000\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSavePidlMRU\exe

The SID in the reg.editor is [S-1-5-21-1956030832-895603407-332460711-1000]

So just Edit the .reg file and replace the SID with the SID in the Registry Editor.

Hope I was clear.

And this is my reference that led me to this solution:

[[[Registry Subkeys in HKEY_USERS

Here is an example of what you might find under the HKEY_USERS hive:

HKEY_USERS\.DEFAULT
HKEY_USERS\S-1-5-18
HKEY_USERS\S-1-5-19
HKEY_USERS\S-1-5-20
HKEY_USERS\S-1-5-21-0123456789-012345678-0123456789-1004
HKEY_USERS\S-1-5-21-0123456789-012345678-0123456789-1004_Classes
...

The SIDs you see listed under HKEY_USERS will certainly differ than the list I included above.

While you'll likely have .DEFAULT, S-1-5-18, S-1-5-19, and S-1-5-20, which correspond to built-in system accounts, your S-1-5-21-xxx keys will be unique to your computer since they correspond to "real" user accounts in Windows.]]]

Thanks, Best Regards...

Essam

Posted 2013-11-28T04:05:15.667

Reputation: 1

Welcome to Super User! Please read the question again carefully. Your answer does not answer the original question. – DavidPostill – 2016-05-18T08:52:22.057