alias isadmin {
if (!$isid) return
set -l %elevated $false
set -l %a $ticks $+ $rand(1111,9999)
if ($com(shell $+ %a)) .comclose shell $+ %a
.comopen shell $+ %a WScript.Shell
if ($comerr) goto end
if (!$com(shell $+ %a,Run,1,bstr,cmd.exe /c whoami /groups > %a $+ .tmp,int,0,bool,true)) goto end
if ($read(%a $+ .tmp,w,*S-1-16-12288*)) %elevated = $true
:end
if ($com(shell $+ %a)) .comclose shell $+ %a
if ($isfile(%a $+ .tmp)) .remove %a $+ .tmp
return %elevated
}