hi @ all!!!
i have a big problem. i wrote a script that needs admin rights on vista and xp.
the problem is that i want to run the script with admin rights which are saved
in a ini file. Then you can run the script on an account without admin rights
with the saved user login data.
Can anyone help me to realize that? I had an old script (i don´t know from where xD)
that worked really good on xp - but it was an very old autoit version.
Thanks!!!!!
Muscle
adminrights()
Func adminrights()
If Not IsAdmin() Then
Opt("RunErrorsFatal", 0)
; Admin-Account user
$run_admin_user = IniRead("data.ini", "Data", "account-user", "-")
; Admin-Account pass
$run_admin_pass = IniRead("data.ini", "Data", "account-pass", "-")
; adminrights
If Not $CMDLINE[0] Then
RunAsSet($run_admin_user, @ComputerName, $run_admin_pass)
Run('"' & @AutoItExe & '" /AutoIt3ExecuteScript "' & @ScriptFullPath & '" /admin')
If @error = 1 Then
MsgBox(48, "-", "Error")
Else
RunAsSet()
EndIf
Exit
ElseIf $CMDLINE[1] <> '/admin' Then
MsgBox(48, "-", "Error")
Exit 1
EndIf
EndIf
EndFunc
If IsAdmin() Then MsgBox(0, "", "NOW adminrights")