Created
April 7, 2024 04:36
UAC Enable/Disable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import winreg | |
def disable_uac(): | |
try: | |
# Disabling UAC in Windows can | |
# expose your system to unauthorized | |
# access and malware threats. | |
# Proceed with caution as it compromises | |
# your system's security. | |
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", 0, winreg.KEY_WRITE) | |
winreg.SetValueEx(key, "EnableLUA", 0, winreg.REG_DWORD, 0) | |
winreg.CloseKey(key) | |
print("UAC disabled successfully.") | |
except Exception as e: | |
print("An error occurred:", e) | |
def enable_uac(): | |
try: | |
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System", 0, winreg.KEY_WRITE) | |
winreg.SetValueEx(key, "EnableLUA", 0, winreg.REG_DWORD, 1) | |
winreg.CloseKey(key) | |
print("UAC enabled successfully.") | |
except Exception as e: | |
print("An error occurred:", e) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment