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