xxxxxxxxxx
import winreg as reg
def disable_windows_update():
try:
# Open the Windows Update settings registry key
key = reg.OpenKey(reg.HKEY_LOCAL_MACHINE, 'Software\\Policies\\Microsoft\\Windows\\WindowsUpdate')
# Disable automatic updates
reg.SetValueEx(key, 'AUOptions', 0, reg.REG_DWORD, 1)
# Close the registry key
reg.CloseKey(key)
print("Windows Update disabled successfully.")
except Exception as e:
print("An error occurred:", str(e))
disable_windows_update()