8

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

1
  • 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
    Oct 10, 2018 at 6:43

3 Answers 3

15

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.

5
  • Great thanks! As that's in HKLM I guess only an admin user could run that though? Sep 24, 2010 at 8:13
  • @AdemDempsey I'm not sure, you'd have to check... I don't currently use any non-admin users.
    – Pylsa
    Sep 24, 2010 at 8:18
  • @AdemDempsey I checked by creating a non-admin user and it works fine!
    – Pylsa
    Sep 24, 2010 at 8:22
  • @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. Dec 26, 2013 at 8:54
  • Perfect! We had hkey mis-spelled in our documentation and this made the command work for me.
    – Michele
    May 12, 2023 at 13:58
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.

0

you can use this:

for /f "tokens=3 delims= " %%a in ('REG QUERY HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\ /v EnableLUA ^| find /i "enablelua"') do (if "%%~a"=="0x1" (echo Enabled) else (echo Disabled))

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .