samkshah Posted April 25, 2007 Share Posted April 25, 2007 Is running RunAsSet() and escalating to admin rights still an issue? I came across this http://www.autoitscript.com/forum/index.php?showtopic=6544 bug report and looks like it has not been updated since long. I am trying to use RunAsSet() in my script to escalate rights to admin account and looks like it does not work. Am I doing anything wrong or is still an issue? Here is my algorithm:local $escalaterights $escalaterights = RunAsSet("adminuser", @LogonDomain, "adminpass", 0) If $escalaterights = 0 Then writeLog("OS does not support RunAsSet function") exitewitherr() EndIf If IsAdmin() then writeLog("rights escalated to account: " & @LogonDomain & "\" & @UserName) else writeLog("could not escalate admin rights") exitwitherr() EndIfAbove code always returns following text in log file:"rights escalated to account: domain\currentuser" instead of "rights escalated to account: domain\adminuser"Any idea on why it's not working or any alternative method that I can use? FYI: This script is for win xp sp2, win 2000 and win2k3 machines. I am using latest version of AutoIT downloaded yesterday - v3.2.2.0 betaThank you much,samkshah Link to comment Share on other sites More sharing options...
samkshah Posted April 25, 2007 Author Share Posted April 25, 2007 FYI: current logged in user also has admin rights. However script does not work if a logged on user does not have admin rights. Link to comment Share on other sites More sharing options...
herewasplato Posted April 25, 2007 Share Posted April 25, 2007 From the help file under RunAsSet: This function allows subsequent Run and RunWait functions... I do not see any "subsequent Run and RunWait functions" in your sample code. RunAsSet does not escalate the rights for all subsequent lines in a script, just Run and RunWait lines... so you IsAdmin line is not impacted by the RunAsSet line above it. ...or perhaps I do not understand "the rest of your code" that is not shown... [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
herewasplato Posted April 25, 2007 Share Posted April 25, 2007 ...I am using latest version of AutoIT downloaded yesterday - v3.2.2.0 beta...The latest beta is v3.2.3.7http://www.autoitscript.com/autoit3/files/beta/autoit/ [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
samkshah Posted April 25, 2007 Author Share Posted April 25, 2007 Thanks for quick response. Let me include my complete code in my next post. My requirement is to run entire script as admin user and not only "Run" or "Runwait" commands. Since I am replacing text in a text file which is in "Program Files" directory, I need to run entire script as admin user. I am sorry for my mistake in previous thread where I told that I was using latest version. I now downloaded a latest beta version and still it's an issue. Thank you much, samkshah Link to comment Share on other sites More sharing options...
herewasplato Posted April 26, 2007 Share Posted April 26, 2007 ...or something on that order.I should have searched for that method and posted a link to it in my reply - it has been posted a few times before (probably by you) - anyway, maybe this should be moved to the support forum as it seems to be "no bug".-MSP- [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Administrators Jon Posted April 26, 2007 Administrators Share Posted April 26, 2007 I've added an example for this in the docs for RunAsSet in the new beta. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
herewasplato Posted April 26, 2007 Share Posted April 26, 2007 I've added an example for this in the docs for RunAsSet in the new beta.Good idea - that is why they pay you the big bucks :-) [size="1"][font="Arial"].[u].[/u][/font][/size] 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