Is there any command which will tell me the state of UAC? Eg it's switched on, off of which level it's on.
-
1From 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 '18 at 6:43
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? – Adam Dempsey Sep 24 '10 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 '10 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. – Peter Hahndorf Dec 26 '13 at 8:54
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))