I am currently trying to figure out, how to set Windows update to "let me choose whether to install" instead of "Install updates automatically" on Windows 8.
According to Check from .NET if Windows Update is enabled I tried:
WUApiLib.AutomaticUpdatesClass auc = new WUApiLib.AutomaticUpdatesClass();
// Doing some stuff
But get following errors:
Interop type 'WUApiLib.AutomaticUpdatesClass' cannot be embedded. Use the applicable interface instead.
The type 'WUApiLib.AutomaticUpdatesClass' has no constructors defined
Following the answer in Change windows updates setting with Powershell I did:
string subKey = @"SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU";
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(subKey, true))
key.SetValue("AUoptions", 4);
But the subkey does not exist in the registry which leads to Reference not set to an instance of an object
errors.
The rest of Google's results all describe how to manually change this setting, which is not what I'm looking for.
How can I programmatically set Windows Updates to "let me choose whether to install"?