Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get UAC settings using powershell

Tags:

powershell

Is there a way to get the UAC status(including level) in windows 7 computer using powershell?

like image 330
Sitaram Pamarthi Avatar asked Aug 04 '10 11:08

Sitaram Pamarthi


2 Answers

(Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System).EnableLUA

will tell u if UAC is enabled or not.

like image 176
ravikanth Avatar answered Nov 15 '22 06:11

ravikanth


The UAC level is recorded in system register keys. You can use the code below to get them.

$Key = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" 
$ConsentPromptBehaviorAdmin_Name = "ConsentPromptBehaviorAdmin" 
$PromptOnSecureDesktop_Name = "PromptOnSecureDesktop" 

$ConsentPromptBehaviorAdmin_Value = Get-RegistryValue $Key $ConsentPromptBehaviorAdmin_Name 
$PromptOnSecureDesktop_Value = Get-RegistryValue $Key $PromptOnSecureDesktop_Name 

Different combinations between $ConsentPromptBehaviorAdmin_Value and $PromptOnSecureDesktop_Valued defines the UAC level.

For the complete sample, you can refer to https://gallery.technet.microsoft.com/How-to-switch-UAC-level-0ac3ea11

like image 22
Eric Avatar answered Nov 15 '22 07:11

Eric