2

Please Help Me To How connect to Registry On another Computer and Read Data in c#.

I am Search in Google and see All Sample Code But None Samples not Connect to Remote machine Registry In Network

H.Sadeghi
  • 25
  • 5

2 Answers2

3

Check it out, Create a RegistryKey and use the following method on it

aKey = RegistryKey.OpenRemoteBaseKey(
    RegistryHive.CurrentUser,
    remoteHost).OpenSubKey("ASubKeyName");

Do not forget that you need enough security permission to do this, for example if you are about to do this in a domained network and you are granted sufficient privileges by being a member of Administrators, the above code will work. You may check system.security.permission before executing above code or catch security exception.

Lee Taylor
  • 7,761
  • 16
  • 33
  • 49
Iman Nia
  • 2,255
  • 2
  • 15
  • 35
0

Iman already provided a good answer, and I would suggest using his if you have the infrastructure (i.e. a domain) and you can get the permissions working. Otherwise, you can create your own simple TCP server that provides access to the registry, then write a client to connect to it. However, if you choose this approach, please remember to use encryption and authentication!!! Otherwise, you will leave yourself open to a security nightmare.

Nick Mertin
  • 1,149
  • 12
  • 27