Is there any command which will tell me the state of UAC? Eg it's switched on, off of which level it's on.
3 Answers
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.
-
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.– PylsaSep 24, 2010 at 8:18
-
-
@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.– MicheleMay 12, 2023 at 13:58
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.
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))