Change registry key in Vista
-
Hi, We have a number of computers (>300), for which we need to change a particular registry setting. So I wrote a C# program that uses this code to do that: RegistryKey regkey = Registry.LocalMachine.OpenSubKey(KeyName, true); regkey.SetValue(KeyValue, 2); When I distribute the executable, it works perfectly for all XP machines. But the Vista machines (even while in user accounts with Admin access) throw an error: System.Security.SecurityException: Requested registry access is not allowed I've tried looking for solutions online but couldn't follow any. Anyone who can help me change a registry key value in Vista through C# code? Thanks, Sarab
-
Hi, We have a number of computers (>300), for which we need to change a particular registry setting. So I wrote a C# program that uses this code to do that: RegistryKey regkey = Registry.LocalMachine.OpenSubKey(KeyName, true); regkey.SetValue(KeyValue, 2); When I distribute the executable, it works perfectly for all XP machines. But the Vista machines (even while in user accounts with Admin access) throw an error: System.Security.SecurityException: Requested registry access is not allowed I've tried looking for solutions online but couldn't follow any. Anyone who can help me change a registry key value in Vista through C# code? Thanks, Sarab
-
Hi, We have a number of computers (>300), for which we need to change a particular registry setting. So I wrote a C# program that uses this code to do that: RegistryKey regkey = Registry.LocalMachine.OpenSubKey(KeyName, true); regkey.SetValue(KeyValue, 2); When I distribute the executable, it works perfectly for all XP machines. But the Vista machines (even while in user accounts with Admin access) throw an error: System.Security.SecurityException: Requested registry access is not allowed I've tried looking for solutions online but couldn't follow any. Anyone who can help me change a registry key value in Vista through C# code? Thanks, Sarab
In addition to what Guffa said, these may help. Look at the System.Security.Permissions.RegistryPermission class and/or Add an app.manifest file and alter the requestedExecutionLevel - this will invoke UAC.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)