- -|||#NoTrayIcon
#include <LocalSecurityAuthority.au3>
_RunAsPowerUser("PowerUser", "Password")
Msgbox(0, @UserName, $CmdLineRaw)
Func _RunAsPowerUser($sPowerUser, $sPassword)
Local $hProcess, $hThread, $iProcessID, $sApp = @ScriptFullPath, $sArg
If $CmdLine[0] = 0 Or $CmdLine[$CmdLine[0]] <> "-RunAsPowerUser" Then
If @Compiled = 0 Then $sApp = @AutoItExe
$sArg = " " & $CmdLineRaw & " -RunAsPowerUser"
$iProcessID = _CreateProcessWithLogon($sPowerUser, $sPassword, "", $sApp, $sArg, _
$hProcess, $hThread)
If $iProcessID Then
_LsaCloseHandle($hProcess)
_LsaCloseHandle($hThread)
Exit
EndIf
EndIf
EndFunc ;==>_RunAsPowerUser
|