Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

RunAsWait drop admin privileges.

$
0
0
Is there anyway to run a command from within the script yet retain the admin privileges of the original script?

The results should be all zero's (success) but the RunAsWait function loses the admin privileges and the commands fails.

[ autoit ]         
#RequireAdmin $RunWaitResult = RunWait(@ComSpec & " /c net session") $RunWaitErrorResult = @error $RunAsWaitResult = RunAsWait("username","domain","password",4,@ComSpec & " /c net session") $RunAsWaitErrorResult = @error MsgBox(0,"Results", _ "$RunWaitResult = " & $RunWaitResult & @CRLF & _ "$RunWaitErrorResult = " & $RunWaitErrorResult & @CRLF & _ "$RunAsWaitResult = " & $RunAsWaitResult & @CRLF & _ "$RunAsWaitErrorResult = " & $RunAsWaitErrorResult ) #cs **** OUTPUT --------------------------- Results --------------------------- $RunWaitResult = 0 $RunWaitErrorResult = 0 $RunAsWaitResult = 2 $RunAsWaitErrorResult = 0 --------------------------- OK --------------------------- #ce

edit: I have tried all 4 logon flags.

Viewing all articles
Browse latest Browse all 12506

Trending Articles



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