Public/Set-UAC.ps1

function Set-UAC {

    <#
    .Description
    This function can Enable/Disable UserAccountControl entirely or just the Prompt Behavior
 
    .PARAMETER Disable
    Disables UAC entirely
 
    .PARAMETER DisablePrompt
    Disables UAC prompting only but leaves UAC enabled
 
    .PARAMETER Enable
    Enables UAC
 
    .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
    )

    #Check for Admin Privleges
    Get-Elevation

    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
    }
}