Need an Example Modifying Remote Registry

  • Thread starter Thread starter Charles
  • Start date Start date
C

Charles

Hi:

I'm looking for an example of modifying the registry of a remote system.

Thanks much!
Charles
 
Charles,

Any example in the documentation will do. The only thing you have to do
differently is call the static OpenRemoteBaseKey to get the hive on the
remote system you want to work with, and proceed from there.
 
I get, "Use the new keyword to create an object instance". And we I do use
new I get
"Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive,
string) is a mathod but is used like a type".

This is what I'm trying to get to work:

RegistryKey Tb2Key =
RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine,
textBox4.Text).OpenSubKey("Software\\Netopia\\Timbuktu Pro\\TimbuktuName");
Tb2Key.SetValue("StringValue", textBox4.Text);

RegistryKey RoKey =
RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine,
textBox4.Text).OpenSubKey("Software\\Microsoft\\Windows
NT\\CurrentVersion\\RegisteredOwner");
RoKey.SetValue("StringValue", textBox3.Text);

RegistryKey CNameKey =
RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine,
textBox4.Text).OpenSubKey("Software\\Microsoft\\Windows
NT\\CurrentVersionRegisteredOrganization");
CNameKey.SetValue("StringValue", "NeuStar Inc");

Tb2Key.Close();
RoKey.Close();
CNameKey.Close();

Nicholas Paldino said:
Charles,

Any example in the documentation will do. The only thing you have to do
differently is call the static OpenRemoteBaseKey to get the hive on the
remote system you want to work with, and proceed from there.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Charles said:
Hi:

I'm looking for an example of modifying the registry of a remote system.

Thanks much!
Charles
 
I made a change and I think I'm close. It's now telling me that I don't have
permissions to the remote system. The remote system is a virtual machine in
my domain and I do have permissions as I am running the program as an admin
of the domain.

RegistryKey CNameKey =
RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine,
textBox4.Text).OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows NT").OpenSubKey("CurrentVersion");

CNameKey.SetValue("RegisteredOrganization", "Company Inc",
RegistryValueKind.String);

Thanks!


Charles said:
I get, "Use the new keyword to create an object instance". And we I do use
new I get
"Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive,
string) is a mathod but is used like a type".

This is what I'm trying to get to work:

RegistryKey Tb2Key =
RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine,
textBox4.Text).OpenSubKey("Software\\Netopia\\Timbuktu Pro\\TimbuktuName");
Tb2Key.SetValue("StringValue", textBox4.Text);

RegistryKey RoKey =
RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine,
textBox4.Text).OpenSubKey("Software\\Microsoft\\Windows
NT\\CurrentVersion\\RegisteredOwner");
RoKey.SetValue("StringValue", textBox3.Text);

RegistryKey CNameKey =
RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine,
textBox4.Text).OpenSubKey("Software\\Microsoft\\Windows
NT\\CurrentVersionRegisteredOrganization");
CNameKey.SetValue("StringValue", "NeuStar Inc");

Tb2Key.Close();
RoKey.Close();
CNameKey.Close();

Nicholas Paldino said:
Charles,

Any example in the documentation will do. The only thing you have to do
differently is call the static OpenRemoteBaseKey to get the hive on the
remote system you want to work with, and proceed from there.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Charles said:
Hi:

I'm looking for an example of modifying the registry of a remote system.

Thanks much!
Charles
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top