Public/Set-UAC.ps1

function Set-UAC {

    <#
    .Synopsis
    -Taylor Lee
    Modified 07062019
 
    .Description
    This function can Enable/Disable UserAccountControl entirely or just the Prompt Behaviour
 
    .Example
    Disabled UAC Prompting for Admins, but keeps UAC enabled
 
    Set-UACState -DisablePrompt
 
    .Example
    Disabled UAC Entirely
 
    Set-UACState -Disable
 
    .Example
    Enable UAC Entirely
 
    Set-UACState -Enable
    #>


    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true, ParameterSetName = 'Disable')][switch]$Disable,
        [Parameter(Mandatory = $true, ParameterSetName = 'DisablePrompt')][switch]$DisablePrompt,
        [Parameter(Mandatory = $true, ParameterSetName = 'Enable')][switch]$Enable
    )

    if ($Disable) {
        reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /f /v "ConsentPromptBehaviorAdmin" /t reg_dword /d 0
        reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /f /v "EnableLUA" /t reg_dword /d 0
    }

    if ($DisablePrompt) {
        reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /f /v "ConsentPromptBehaviorAdmin" /t reg_dword /d 0
    }

    if ($Enable) {
        reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /f /v "ConsentPromptBehaviorAdmin" /t reg_dword /d 2
        reg.exe add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /f /v "EnableLUA" /t reg_dword /d 1
    }
}