HKEY_USERS contains only registered users

I am writing a C # application.

As part of my application, I need to read user profiles.

To get all users, I use Registry.Users.GetSubKey() .

The problem is that in Windows 8 HKEY_USERS contains only registered users! (when there are 2 users who are logged in, I see 2 users in the HKEY_USERS section, but if one of the users logs out, then in HKEY_USERS ) there will be only 1 user)

As a result, I get profiles only for registered users.

I tried to find the entire registry to find where the data is stored, but I can’t find this information anywhere .... it looks like the information will disappear when the user logs out.

Is it design or bug?

If the data is saved - it should be in the registry, but I can not find it ...

Could this be in permissions? Maybe there is information, but it is hidden when the user is not logged in? Is there a flag or something that I can use to read the profile for unregistered users?

+4
source share
2 answers

As part of my application, I need to read user profiles.

Then you need to redesign your application. What you ask for is impossible.

From Raymond Chen's diary, "Beware of roaming user profiles :

[Y] ou cannot just cruise through the registry key HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows NT \ CurrentVersion \ ProfileList, expecting to find all user profiles and possibly even change them, because a copy of the user profile on the local computer cannot be authoritative.

Everything that you see on your local machine relating to profiles of other users - whether in HKEY_USERS or in the profile directories in C: \ Users - is just a local cache since the last login to this computer. Real data, modern data, is stored on a domain controller somewhere.

You cannot rely on other users' local storage data for anything at all. You better pretend he's not even there.

+7
source

This may not work in all cases, but it fits my needs. Download registry hive

 reg load HKU\Steven C:\Users\Steven\ntuser.dat 

Read the required data, then upload

 reg unload HKU\Steven 

Example

+3
source

All Articles