How to get permission to write to the Windows registry via VB the key HKEY_LOCAL_MACHINE

0

I'm trying to record a record inside HKEY_LOCAL_MACHINE\SYSTEM and visual studio / visual basic will not let me have access. It says that I am not allowed to record my record.

My command:

My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\SYSTEM", "1", &H1I, Microsoft.Win32.RegistryValueKind.DWord)

The error:

Thanks to all who can help; I will share my project here in the end in thanks to the whole community.

    
asked by anonymous 25.09.2014 / 23:58

1 answer

4

The HKEY_LOCAL_MACHINE key only allows writing if the user logged in to Windows is an administrator, and in the case of UAC if the program that is trying to modify the value has been executed with elevated permissions.

In general you should not make any changes within HKEY_LOCAL_MACHINE, any program settings for example should be saved in HKEY_CURRENT_USER

    
26.09.2014 / 03:53