As pointed out in solution #1,
HKEY_LOCAL_MACHINE
is a registry hive. It is not a sub-key of
HKEY_CURRENT_USER
.
If you want to write to the key, then you need to pass
True
to the
writable
parameter.
Dim WSUS As RegistryKey = Registry.LocalMachine.OpenSubKey("Software\Policies\Microsoft\Windows\WindowsUpdate\AU", True)
NB: Since you're trying to modify the machine configuration, your application will need to run elevated. Add a manifest to your application, and set
requestedExecutionLevel
to
requireAdministrator
.
Making Your Application UAC Aware[
^]