Skip to content

Instantly share code, notes, and snippets.

@ismits
Created July 3, 2019 11:42
Show Gist options
  • Save ismits/ea44112d5a1c2ea09afec3eda4a6b249 to your computer and use it in GitHub Desktop.
Save ismits/ea44112d5a1c2ea09afec3eda4a6b249 to your computer and use it in GitHub Desktop.
Disable UAC via PowerShell
function Disable-UAC
{
Write-Log "Disabling User Access Control (UAC)..."
$RegPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
New-RegKey $RegPath
Write-Log (New-ItemProperty -Path $RegPath -Name "EnableLUA" -Value 0 -PropertyType "DWORD" -Force)
Write-Log (New-ItemProperty -Path $RegPath -Name "ConsentPromptBehaviorAdmin" -Value 0 -PropertyType "DWORD" -Force)
Write-Log ("Disabling User Access Control (UAC) complete.")
return $true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment