Hi all,
I have the following code to add/edit one entry to the registry. The code runs fine on three different Windows Servers 2003. However it just crashes the application on our fourth server. No exception is thrown/caught no nothing. The app just dies without any traces. Nothing in the event log either. Just disappears. I believe this has something to do with security. I checked the Permissions of the key and they are OK. I am using user which is member of the Administrators group so I have full rights. The key gets opened and then on the call of the SetValue method the application just dies without any traces.
The code itself is very simple:
try
{
using (RegistryKey regKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"))
{
regKey.SetValue("Test", "C:\\test.exe", RegistryValueKind.String);
}
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
Any help is greatly appreciated.
Thanks, Dimitar