Rorax Posted March 6, 2008 Share Posted March 6, 2008 Not even something simple as this works: RunAsSet('InsertAdminAccount', @Computername, 'InsertAdminPassword') FileDelete('C:\Delete.txt') RunasSet() I've tried using " instead of ' I've tried using the computername instead of @computername I've tried making a different admin account If I insert @Username and $admin = IsAdmin() and set it to a msgbox it always output the current user and not as admin (since I run it as a user) And administrator have full NTFS rights to the C:\Delete.txt and users have read only. I've tried using RunAs in a cmd window, and that works perfectly with the admin account/password. I cant figure out why it wont work with RunAsSet :S and I run the script from a local directory so no networkshares involved. The Secondary logon service is started, tried several different computers also. I got version 3.2.10.0 of Autoitv3 and also tried to compile it with version 3.2.18.0 (I think it was that at least it wasnt the same version I have). Any ideas? Regards, Rorax Link to comment Share on other sites More sharing options...
BrettF Posted March 6, 2008 Share Posted March 6, 2008 (edited) Not even something simple as this works: RunAsSet('InsertAdminAccount', @Computername, 'InsertAdminPassword') FileDelete('C:\Delete.txt') RunasSet() I've tried using " instead of ' I've tried using the computername instead of @computername I've tried making a different admin account If I insert @Username and $admin = IsAdmin() and set it to a msgbox it always output the current user and not as admin (since I run it as a user) And administrator have full NTFS rights to the C:\Delete.txt and users have read only. I've tried using RunAs in a cmd window, and that works perfectly with the admin account/password. I cant figure out why it wont work with RunAsSet :S and I run the script from a local directory so no networkshares involved. The Secondary logon service is started, tried several different computers also. I got version 3.2.10.0 of Autoitv3 and also tried to compile it with version 3.2.18.0 (I think it was that at least it wasnt the same version I have). Any ideas? Regards, RoraxAre you on Vista? EDIT: FileSetAttribute? Edited March 6, 2008 by Bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Rorax Posted March 6, 2008 Author Share Posted March 6, 2008 Are you on Vista?EDIT:FileSetAttribute?Forgot to mention that, no I'm using Windows XP SP2 and will also be using it on some Windows 2000 SP4 machines (not this particular script but a script with RunAsSet) The file itself doesnt have Readonly or anything like that. With admin rights you can delete it without any problems. Link to comment Share on other sites More sharing options...
BrettF Posted March 6, 2008 Share Posted March 6, 2008 (edited) I was hoping you would re-RTFM. But alas, no. "This function allows subsequent Run and RunWait functions to run as a different user (e.g. Administrator)." Edited March 6, 2008 by Bert Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Rorax Posted March 6, 2008 Author Share Posted March 6, 2008 (edited) I was hoping you would re-RTFM. But alas, no. "This function allows subsequent Run and RunWait functions to run as a different user (e.g. Administrator)." Edit: Since english isnt my native tounge, I'll try to explain it even easier (removed other text I replied with). This is a exact copy of the RunAsSet test script I'm trying to run. I made a new user which is a member of the local administrator group, named the account "a" and set the password to "b" (not member of both users/administrators groups, only administrators). RunAsSet("a", @Computername, "b") FileDelete("C:\Delete.txt") RunasSet() The file Delete.txt in the root of C: has the following properties: C:\>attrib delete.txt A C:\delete.txt A = Archive Using Net user a (might not be the same names for things since it show up in swedish for me and I translated it and removed parts I didnt find necessery) C:\>Net user a Username a Memberships *Administratörer (is the swedish name for the administrator group) NTFS rights on C:\Delete.txt C:\>cacls c:\delete.txt c:\delete.txt BUILTIN\Administratörer:F NT INSTANS\SYSTEM:F BUILTIN\Användare:R Explanations: Administratörer = Local administrator group Användare= Local user group F= Full access R= Read Trying to start Secondary Logon Service with Net start C:\>net start "Secondary Logon Service" Tjänsten är redan igång. (Translated to: Service is already started) Du kan få mer hjälp genom att skriva NET HELPMSG 2182. (Translated to: You can get more help by typing NET etc) Now it might be easier to tell me what I do wrong with the above code? Oh and I should say that I compile the script as a administrator, put it locally for another user in the Users group with the NTFS right Read on the scripts exe file and execute it from that user (named Test, not that it mather) Edited March 6, 2008 by Rorax Link to comment Share on other sites More sharing options...
BrettF Posted March 6, 2008 Share Posted March 6, 2008 RunAsSet is only designed to initialise a set of user credentials to use during Run and RunWait operations. Not FileDelete. How much clearer can I make it?? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Rorax Posted March 6, 2008 Author Share Posted March 6, 2008 RunAsSet is only designed to initialise a set of user credentials to use during Run and RunWait operations. Not FileDelete. How much clearer can I make it??Thats clear enough. I didnt get that from your quote at first. But that explains a lot. Thank you 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