Skip to content

Instantly share code, notes, and snippets.

@Zerg00s
Created April 25, 2023 18:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zerg00s/98bd6742ce93957eaa2ac7b321406f26 to your computer and use it in GitHub Desktop.
Save Zerg00s/98bd6742ce93957eaa2ac7b321406f26 to your computer and use it in GitHub Desktop.
Disable LUA
$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
$keyName = "EnableLUA"
$desiredValue = 0
try {
if (Test-Path $registryPath) {
$currentValue = Get-ItemProperty -Path $registryPath -Name $keyName -ErrorAction Stop
if ($currentValue.$keyName -ne $desiredValue) {
Set-ItemProperty -Path $registryPath -Name $keyName -Value $desiredValue -ErrorAction Stop
Write-Host "The value of '$keyName' has been set to $desiredValue."
} else {
Write-Host "The value of '$keyName' is already set to $desiredValue."
}
} else {
Write-Error "Registry path '$registryPath' not found."
}
} catch {
Write-Error "An error occurred while updating the registry: $_"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment