ps/Modules/Alkami.PowerShell.ServerManagement/Public/Disable-UAC.ps1
2023-05-30 22:51:22 -07:00

23 lines
770 B
PowerShell

function Disable-UAC {
<#
.SYNOPSIS
Disables UAC/LUA By Modifying the Registry. A reboot is required for the change to take effect
#>
[CmdletBinding()]
param()
$logLead = (Get-LogLeadName);
$itemProp = Get-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLUA"
if ($itemProp.EnableLUA -eq 0) {
Write-Output ("$logLead : The EnableLUA DWORD is Already Set to 0 -- no changes required")
return
}
Write-Output ("$logLead : Setting the EnableLUA DWORD Value to 0")
Write-Warning ("$logLead : A Reboot is Required for the Change to Take Effect!")
Set-ItemProperty -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" -Name "EnableLUA" -Value "0"
}