Meldrath Posted May 1, 2013 Share Posted May 1, 2013 I am trying to elevate my FileOpen() to read a file that is remote (no problem there), and unfornately needs to have elevated permissions to be read. Any help? Can not use any other 3rd party software to help with this other than this script. Link to comment Share on other sites More sharing options...
Vincor Posted May 1, 2013 Share Posted May 1, 2013 Googling for "autoit require elevation" gives this as first link:http://www.autoitscript.com/autoit3/docs/intro/autoit_on_vista.htmIsn't it what you need? Link to comment Share on other sites More sharing options...
Meldrath Posted May 1, 2013 Author Share Posted May 1, 2013 No this is being done on a remote computer that the users have no access to admin info. I know how to runas, but I can not properly either get the whole script elevated to admin level or an individual function or just the FileOpen() function. Link to comment Share on other sites More sharing options...
Vincor Posted May 1, 2013 Share Posted May 1, 2013 Hmmm, I see. Next questions would be: - Are these computers (yours, remote?) in a domain? - Are you admin in that domain? - Are you running your script locally or at the remote computer? Maybe you'd solve this with e.g. PSTools by SysInternals? Link to comment Share on other sites More sharing options...
Meldrath Posted May 1, 2013 Author Share Posted May 1, 2013 (edited) They are my remote computers (work), I am an admin, and I'm running the script remotely. Func ReadFile($ecmlocation) $file = FileOpen($ecmlocation) ;Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ;Read in lines of text until the EOF is reached $eachline=1 ;line to be read While $eachline <4 ;line by line until line 4 $line = FileReadLine($file) $PosOfStore = StringInStr ($line,"glob_store_code=") ;it looks for the string "glob_store_code=", >0 means found something matching that! if $PosOfStore >0 Then ;if does not find it will quit the loop $store_id = stringmid($line, $PosOfStore + 20,4) ; if it finds something it will grab the store ID Ex: 003A ExitLoop Else $store_id ="nothing" ; if does not find anything it will quit and return "nothing" EndIf Wend FileClose($file) Return $store_id EndFunc I am trying to get this to pull up from the 2nd terminal, information on the first terminal, but it requires elevation to open the file on that network as both computers there are users. Edited May 1, 2013 by Meldrath Link to comment Share on other sites More sharing options...
Vincor Posted May 1, 2013 Share Posted May 1, 2013 See this post: Then add a -s to your psexec calls, when using your admin credentials. That will enable running as system. (http://ss64.com/nt/psexec.html)Plus, your code needs some polishing. Your loop doesn't seem right. That $eachline is not going anywhere... 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