Disable User Account Control (UAC)
# Script to disable User Account Control (UAC)
# Define the registry path and value
$regPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
$regValue = "EnableLUA"
# Check if the registry key exists
if (Test-Path $regPath) {
# Disable UAC by setting EnableLUA to 0
Set-ItemProperty -Path $regPath -Name $regValue -Value 0
Write-Output "User Account Control (UAC) has been disabled."
# Prompt to reboot the system
Write-Output "A system restart is required for changes to take effect."
Read-Host -Prompt "Press Enter to restart now, or Ctrl+C to cancel"
Restart-Computer -Force
} else {
Write-Output "Registry path does not exist. UAC may not be enabled on this system."
}
Explanation of the Script Steps
1. Registry Path: The script sets the path to the UAC settings in the Windows Registry.
2. Check Registry Key: It checks if the specified registry key exists. If it does, it proceeds to modify the UAC settings.
3. Disable UAC: The script sets the EnableLUA registry value to 0, which disables UAC.
4. Prompt for Restart: A message prompts the user to restart the computer for the changes to take effect. If the user presses Enter, the script will restart the computer immediately.
Running the Script
1. Open PowerShell as an administrator.
2. Copy and paste the above script into the PowerShell window.
3. Press Enter to run the script.
Important Notes
• Backup Registry: It’s a good practice to back up the registry before making any changes. You can do this using the regedit tool.
• Re-enable UAC: If you decide to re-enable UAC later, you can set the EnableLUA value back to 1 using a similar script.
• Security Implications: Disabling UAC can make your system more vulnerable to malware and unauthorized changes. Consider whether this is necessary for your environment.
Last updated