This will display a popup showing whether UAC is “Evalated” or “Not Evalated” using VBS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | Dim oShell, oExec, szStdOut szStdOut = "" Set oShell = CreateObject("WScript.Shell") Set oExec = oShell.Exec("whoami /groups") Do While (oExec.Status = cnWshRunning) WScript.Sleep 100 if not oExec.StdOut.AtEndOfStream then szStdOut = szStdOut & oExec.StdOut.ReadAll end if Loop select case oExec.ExitCode case 0 if not oExec.StdOut.AtEndOfStream then szStdOut = szStdOut & oExec.StdOut.ReadAll end if if instr(szStdOut,"S-1-16-12288") Then wscript.echo "Elevated" else if instr(szStdOut,"S-1-16-8192") Then wscript.echo "Not Elevated" else wscript.echo "Unknown!" end if end if case else if not oExec.StdErr.AtEndOfStream then wscript.echo oExec.StdErr.ReadAll end if end select |
Thanks to: http://blogs.technet.com/b/jhoward/archive/2008/11/19/how-to-detect-uac-elevation-from-vbscript.aspx