Managing UAC with PowerShell

User Account Control (UAC) is a security component that enables users to perform common tasks as non-administrators, and as administrators without having to switch users, log off, or use Run As.

By separating user and administrator functions, UAC helps users move toward using standard user rights by default.

UAC can be managed using the registry.

.

uacps

.

The registry entry to modify is the following:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]

“EnableLUA”

.

.

The following PowerShell script allows to disable or enable UAC.

The system will require a reboot for changes to the UAC settings to take effect.

.

# Disable UAC
#==================================================================================
Try {
	Set-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -Value 0
	Write-Host "UAC is now disabled. Please reboot the machine."
} 
Catch {
	Write-Host "Error - Exception caught in disabling UAC : $error[0]"
}



# Enable UAC
#==================================================================================
Try {
	Set-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -Value 1
	Write-Host "UAC is now enabled. Please reboot the machine."
} 
Catch {
	Write-Host "Error - Exception caught in enabling UAC : $error[0]"
}