Quantcast
Channel: Sysinternals Forums
Viewing all articles
Browse latest Browse all 10386

BgInfo : Display UAC Status

$
0
0
Author: larsusn
Subject: Display UAC Status
Posted: 26 April 2013 at 3:21am

This is the VBScript I recently created for my Windows 7 Desktop (Microsoft Windows [Version 6.1.7601])


dim base, regELUA, regCPBA, regCPBU, regPOSD

base = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\"

Set objShell = CreateObject("WScript.Shell")
regELUA = objShell.RegRead(base & "EnableLUA")
regCPBA = objShell.RegRead(base & "ConsentPromptBehaviorAdmin")
regCPBU = objShell.RegRead(base & "ConsentPromptBehaviorUser")
regPOSD = objShell.RegRead(base & "PromptOnSecureDesktop")

'wscript.echo "EnableLUA:                 " & vbtab & regELUA
'wscript.echo "ConsentPromptBehaviorAdmin:" & vbtab & regCPBA
'wscript.echo "ConsentPromptBehaviorUser: " & vbtab & regCPBU
'wscript.echo "PromptOnSecureDesktop:     " & vbtab & regPOSD

if (regELUA = 1 and regCPBU >= 1 and regCPBU <= 3 and regCPBA = 2) then
    strUSER  = "Always Notify"
    strADMIN = "Always Notify"
elseif (regELUA = 1 and regCPBU >= 1 and regCPBU <= 3 and regCPBA = 5) then
    strUSER  = "Always Notify"
    strADMIN = "Only Notify on Program Change"
elseif (regELUA = 0 and regCPBU >= 1 and regCPBU <= 3 and regCPBA = 0) then
    strUSER  = "Always Notify"
    strADMIN = "Disabled"
elseif (regELUA = 0 and regCPBU = 0 and regCPBA = 0) then
    strUSER  = "Disabled"
    strADMIN = "Disabled"
else
    strUSER  = "Unknown"
    strADMIN = "Unknown"
end if

if refPOSB = 1 then
    strDIMDESK = " & Dim Desktop"
elseif refPOSB = 0 then
    strDIMDESK = " & Do Not Dim Desktop"
end if

if strADMIN = "Disabled" or strADMIN = "Unknown" then
    strValA = "Admins:" & vbtab & strADMIN
else
    strValA = "Admins:" & vbtab & strADMIN & strDIMDESK
end if
if strUSER = "Disabled" or strUSER = "Unknown" then
    strValU = "Users:" & vbtab & strUSER
else
    strValU = "Users:" & vbtab & strUSER & strDIMDESK
end if


strName = "User Account Control (UAC):"
strValue = strValU & vbcrlf & vbtab & strValA
bginfo = strName & vbtab & strValue

echo bginfo


Viewing all articles
Browse latest Browse all 10386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>