1

I get remote registry key via such code:

RegistryKey reg = RegistryKey.OpenRemoteBaseKey(RegistryHive.Users,
"machineName", RegistryView.Default);

My questions:

  1. How can I get from registry of remote machine the list of user names?
  2. How can I get for each user his HKCU registry from HKEY_USERS of the remote machine?

P.S. The Many my users has the Roaming Windows profiles.

Filburt
  • 17,626
  • 12
  • 64
  • 115
Andrey Bushman
  • 11,712
  • 17
  • 87
  • 182
  • 2
    What have you tried? And what are you trying to accomplish? Why do you want to get the user names from the registry? Why do you need their whole HKCU tree? – CodeCaster Oct 01 '12 at 10:59
  • @CodeCaster: I need to get some program settings, which are stored in HKCU. If it will be necessary, then I will change it. – Andrey Bushman Oct 01 '12 at 11:03
  • We are using AutoCAD. This program used own profiles, which are stored in registry key (HKCU\Software\Autodesk\AutoCAD\\\e.t.c\Profiles). All users must to have equal some AutoCAD profile settings. It is requirement of our Company Standard, for equal documentation build. – Andrey Bushman Oct 01 '12 at 11:14
  • 1
    I would expect that the HKCU hive of each user is only ever loaded (from disk) when that particular user is logged on - in one way or the other. So your best option might to impersonate each user and execute your registry-reading-code in that context. – Christian.K Oct 01 '12 at 11:44
  • possible duplicate of [Impersonation to get user HKEY_CURRENT_USER does not work?](http://stackoverflow.com/questions/1429837/impersonation-to-get-user-hkey-current-user-does-not-work). Title sounds missleading, but I think it presents a solution to your question. – Christian.K Oct 01 '12 at 11:51
  • If you have roaming user profiles, then you should be aware that there's no real way to iterate through all users profiles (it's difficult enough when dealing with local profiles on a single machine) – Damien_The_Unbeliever Oct 01 '12 at 12:17
  • Is this task has no simple decision? – Andrey Bushman Oct 01 '12 at 12:30
  • Ok. Can I get username from active directory c# via his GUID which I get from HKU? – Andrey Bushman Oct 01 '12 at 12:36
  • 3
    _"I need to get some program settings, which are stored in HKCU. If it will be necessary, then I will change it."_ - then why don't you apply the appropriate registry setting through a [group policy](http://blogs.technet.com/b/askds/archive/2007/08/14/deploying-custom-registry-changes-through-group-policy.aspx)? – CodeCaster Oct 01 '12 at 12:40
  • @CodeCaster I have wrote .Net library, which create for me the report about AutoCAD settings from network computers. This library allow me to change this settings, if I need it. But I get info from HKLM and HKCU (my profile), not for target user's registry key. I need fix it, and then I can use this library in my tools for CadManager program. Thank you for link, I will read it now. – Andrey Bushman Oct 01 '12 at 12:53
  • Group policy does what you need. Stop wasting your time on pointlees wheel re-invention. Simply push the common settings out via group policy. – David Heffernan Oct 03 '12 at 15:25

0 Answers0