Created
April 25, 2023 18:29
-
-
Save Zerg00s/98bd6742ce93957eaa2ac7b321406f26 to your computer and use it in GitHub Desktop.
Disable LUA
This file contains hidden or 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
$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