Guest arthitchinnachot Posted January 31, 2004 Share Posted January 31, 2004 How to use Autoit execute at remote computer if I know the administrator password? I mean has any functions in Autoit to do such this. Thanks in advanced. arthitchinnachot Link to comment Share on other sites More sharing options...
Developers Jos Posted January 31, 2004 Developers Share Posted January 31, 2004 (edited) When you want to just run programs in admin mode you can: (this is from the Helpfile) Example ; Set the RunAs parameters to use local adminstrator account RunAsSet("Administrator", @Computername, "adminpassword") ; Run registry editor as admin RunWait("regedit.exe") ; Reset user's permissions RunAsSet() When you need to do other stuff in the script you can restart the script in admin credentials (Larry posted this idea a while ago): $Username = "administrator" $Password = "xyz" $Run = 0 ; retrieve the STEP from commandline If $CmdLine[0] = 1 then $run = $CmdLine[1] ; If $run = 0 then If Not isadmin() Then RunAsSet ($Username, @Computername, $Password) ; start the script program (itself) again but now in Adminmode...so all tasks will run in Adminmode Run('"' & @ScriptFullPath & '" " 1"' ) If @error = 1 Then msgbox(48,"Error","cannot start the installation because we are unable to change to adminmode.") EndIf Exit EndIf EndIf : stuff you want to do in admin mode ; Edited January 31, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Guest arthitchinnachot Posted January 31, 2004 Share Posted January 31, 2004 Thanks so much, JdeB. How can I apply this script to run more computers(200-500 client computers) in the same time,these computer have the same password? My idea is use computer name as variable get computer name from text file, how? Could you please guide me some? Thanks, arthitchinnachot Link to comment Share on other sites More sharing options...
Developers Jos Posted January 31, 2004 Developers Share Posted January 31, 2004 Don't these pc's have the same buildin Administrator account that you could use ? To retrieve the computername you can use the macro: @ComputerName SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 31, 2004 Developers Share Posted January 31, 2004 (edited) I think i misunderstood you after reading it again... if you want to store the passwords per computer in a file and read it you could do something like the below (Didn't test it so might contain errors) You can also put them in a Array in the program ... would be saver i think... ; content of info.txt : computername,psw ; $fh1=fileopen("info.txt",0) If $fh1 = -1 Then MsgBox(0, "Error", "Unable to open file:") Exit EndIf while 1 $line = FileReadLine($fh1) If @error = -1 Then msgbox(0,"error". " password not found") Exit endif $u_Info = Stringsplit( $line,",") if $u_Info[0] = @computername then $Password = $u_Info[1] exitloop EndIf Wend Fileclose($fh1) ; Set the RunAs parameters to use local adminstrator account RunAsSet("Administrator", @Computername, $password) ; Run registry editor as admin RunWait("regedit.exe") ; Reset user's permissions RunAsSet() Edited January 31, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now