I found that I could as CraigTP showed use the OpenRemoteBaseKey() method however it required me to change the permissions in the registry on the dest computers.
Here is the code I wrote that worked once I changed the permissions.
RegistryKey rkey = RegistryKey.OpenRemoteBaseKey(RegistryHive.LocalMachine, "RemoteComputer");
RegistryKey rkeySoftware = rkey.OpenSubKey("Software");
RegistryKey rkeyVendor = rkeySoftware.OpenSubKey("VendorName");
RegistryKey rkeyVersions = rkeyVendor.OpenSubKey("Versions");
String[] ValueNames = rkeyVersions.GetValueNames();
foreach (string name in ValueNames)
{
MessageBox.Show(name + ": " + rkeyVersions.GetValue(name).ToString());
}
I also found that I could get the same info using WMI without having to modify the permissions. Here is the code with WMI.
ManagementScope ms = new ManagementScope();
ms.Path.Server = "flebbe";
ms.Path.NamespacePath = "root\\default";
ms.Options.EnablePrivileges = true;
ms.Connect();
ManagementClass mc = new ManagementClass("stdRegProv");
mc.Scope = ms;
ManagementBaseObject mbo;
mbo = mc.GetMethodParameters("EnumValues");
mbo.SetPropertyValue("sSubKeyName", "SOFTWARE\\VendorName\\Versions");
string[] subkeys = (string[])mc.InvokeMethod("EnumValues", mbo, null).Properties["sNames"].Value;
ManagementBaseObject mboS;
string keyValue;
foreach (string strKey in subkeys)
{
mboS = mc.GetMethodParameters("GetStringValue");
mboS.SetPropertyValue("sSubKeyName", "SOFTWARE\\VendorName\\Versions");
mboS.SetPropertyValue("sValueName", strKey);
keyValue = mc.InvokeMethod("GetStringValue", mboS, null).Properties["sValue"].Value.ToString();
MessageBox.Show(strKey + " : " + keyValue);
}
P.S.
I am calling the GetStringValue() method in the loop as I know all the values are strings. If there are multiple data types you would need to read the datatype from the Types output parameter of the EnumValues method.