Click here to Skip to main content
15,041,393 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am able to read Local system's registry subkeys using the following code. But I am unable to read Remote system's registry subkeys. How to do it? Help me through C#.

RegistryKey reg = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Management\\ARPCache");
        if (reg == null)
            PutMsg("No such key");
        string[] AppNames = reg.GetSubKeyNames();
Updated 17-Mar-11 21:03pm

1 solution

Try something like:
RegistryKey baseKey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, "server");

RegistryKey sk1 = baseKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Management\\ARPCache");

Do make sure that you have proper access privileges in place to access it or else you are bound to get some security exception.
sacraj 18-Mar-11 4:44am
Sorry this solution throws an Unauthorized exception. I even tried with Administrator user. But I could not get the answer. Please help me it is urgent.
Sandeep Mewara 18-Mar-11 4:52am
I told so. Proper domain account should be there.
sacraj 18-Mar-11 5:59am
I am running this code from Administrator Which means the system has all the permissions I hope so If I am wrong Please correct Me
Sandeep Mewara 18-Mar-11 6:00am
I guess so. Probably better you talk to your IT guys for it.
sacraj 18-Mar-11 6:05am
Yes I agree with your point, I have been searching this for long days , I am not able to get the answer, If you know some IT guys Could you please help me to solve this problem. Thank you
Sandeep Mewara 18-Mar-11 4:52am
Have a look at this thread:
Espen Harlinn 18-Mar-11 5:08am
Right, nice effort, my 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900