UAC Status from Command Line

6

3

Is there any command which will tell me the state of UAC? Eg it's switched on, off of which level it's on.

Adam Dempsey

Posted 2010-09-24T07:28:54.760

Reputation: 255

1

From user Justin D: Please note that the computer needs to be rebooted after registry value is set for UAC disable/enable to be effective. Reg query may show UAC is disabled/enabled but it may not be effective if the computer is not rebooted.

– fixer1234 – 2018-10-10T06:43:26.093

Answers

12

Run from the command prompt

REG QUERY HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\ /v EnableLUA

if you get

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System
    EnableLUA    REG_DWORD    0x1

UAC is enabled, but if you get

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System
    EnableLUA    REG_DWORD    0x0

UAC is disabled.

BloodPhilia

Posted 2010-09-24T07:28:54.760

Reputation: 27 374

Great thanks! As that's in HKLM I guess only an admin user could run that though? – Adam Dempsey – 2010-09-24T08:13:23.790

@AdemDempsey I'm not sure, you'd have to check... I don't currently use any non-admin users. – BloodPhilia – 2010-09-24T08:18:29.407

@AdemDempsey I checked by creating a non-admin user and it works fine! – BloodPhilia – 2010-09-24T08:22:19.577

@BloodPhilia - In some edge cases this does not work. On my system EnableLUA is set to 0x1 yet still UAC is not active. This can happen on a server OS where you have removed the GUI components. UAC is never enabled on Server Core. – Peter Hahndorf – 2013-12-26T08:54:48.250

0

This will work for Windows 7 - Windows 10 as a batch file (.cmd or .bat) or command line.

Batch file:

    @echo off

    reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v "ConsentPromptBehaviorAdmin" | find  "0x0" >NUL
    if "%ERRORLEVEL%"=="0"  ECHO UAC disabled
    if "%ERRORLEVEL%"=="1"  ECHO UAC enabled
    pause

    exit

Command Line:

    REG QUERY HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\ /v ConsentPromptBehaviorAdmin

If you get "0x0" UAC is disabled.

George H. Compton IV

Posted 2010-09-24T07:28:54.760

Reputation: 1