Jump to content

RunAs > final explanation please


Recommended Posts

Hi,

there are dozend of threads to this I know, but I still dont get it since they are somehow contradictiv.

RunAs( @UserName ,@ComputerName, "myPass" , 0 ,@ComSpec, "" ,@SW_SHOW)

This does not start a cmd with adminrights for me

- Win8 x64

- logged in as admin

If I use #requireAdmin it works even without "RunAs". But I got the damn password, and this should allow me

to skip the uac -prompts and what is the purpose of "RunAs" if not that? I cannot automate if UAC is prompted :(

I read the script cannot pass Access Tokens that it doesnt own ( #requireAdmin ). But again: What then is the purpose of "RunAs"?

I know I can use shellexecute with the 'runAs' parameter but this leads to a UAC promt also. So final Question:

Can I use my password to start any program elevated in autoit yes or no?

thank you very much

Blues

 

My UDF: [topic='156155']_shellExecuteHidden[/topic]

Link to comment
Share on other sites

From what I've read, you can't elevate a process past the level that the current user has in Win Vista+. In other words you can't run as an administrator a process started from a lower security level. RunAs is intended to be used to run a process under another user's credentials, in XP I believe it was possible to run it as an administrator even though the current user wasn't an admin, which is one of the many reasons that XP was such a vast security hole.

http://msdn.microsoft.com/en-us/library/bb756922.aspx

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Oh I just discovered, that it seems not to be enough that your account has admin-rights

but one really has to use the "administrator" account.

To have an aditional account with admin rights only preserves you from entering the password when elevating a programm.

but elevating a program by using your accounts password seems not to be possible in auto it. Is that correct now?

Blues

My UDF: [topic='156155']_shellExecuteHidden[/topic]

Link to comment
Share on other sites

  • 2 weeks later...

Quite Annoying the same script doesn't work in Windows XP SP3 :-( Might it be because MS is going to stop XP in April ? :-)

#RequireAdmin 
RunAsWait( @UserName ,@ComputerName,"myP@ssword", 0 ,@ComSpec & ' /k md test')

It just doesn't throw any errors.

the output windows says--

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "E:\AutoIT\lastone.au3" /UserParams
+>07:01:32 Starting AutoIt3Wrapper v.2.1.4.0 SciTE v.3.3.7.0 ;  Keyboard:00000409  OS:WIN_XP/Service Pack 3  CPU:X64 OS:X86    Environment(Language:0409  Keyboard:00000409  OS:WIN_XP/Service Pack 3  CPU:X64 OS:X86)
>Running AU3Check (3.3.10.2)  from:C:\Program Files\AutoIt3
+>07:01:32 AU3Check ended.rc:0
>Running:(3.3.10.2):C:\Program Files\AutoIt3\autoit3.exe "E:\AutoIT\lastone.au3"
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
+>07:01:36 AutoIt3.exe ended.rc:0
>Exit code: 0    Time: 4.327

This might be the issue with my another thread. '?do=embed' frameborder='0' data-embedContent>>
Does XP requires any extra settings in AutoIt?

Edited by lexicon
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...