Modify

Opened 16 years ago

Closed 16 years ago

#429 closed Feature Request (Rejected)

shellexecute() new feature

Reported by: lookinmyeyes Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc: jeff.ketchum@…

Description

I have code that i would use runasset() to change the profile that a program will run under with version 3.10,
i used shellexecute() after runasset() to elevate the shellexecute to specifig user privileges.
i know i can use
ShellExecute("rundll32.exe", "shell32.dll, OpenAs_RunDLL " & $filename, "", "runas")

to get the windows run as box, but this requires to enter username and password after they have been entered into the autoit code to start up the application.

I am suggesting something like shellexecuteas() or something similar to runas() so that we can specify in the code username and password to use.

Attachments (0)

Change History (2)

comment:1 Changed 16 years ago by TicketCleanup

  • Version 3.2.12.0 deleted

Automatic ticket cleanup.

comment:2 in reply to: ↑ description Changed 16 years ago by Valik

  • Resolution set to Rejected
  • Status changed from new to closed

Replying to lookinmyeyes:

I have code that i would use runasset() to change the profile that a program will run under with version 3.10,
i used shellexecute() after runasset() to elevate the shellexecute to specifig user privileges.

You must have a magical version of AutoIt, then. What you suggest just simply was not implemented that way. You were still running the script in the context of the caller, not the callee you thought. In other words, removing RunAsSet() did not remove any functionality some of you think you had.

i know i can use
ShellExecute("rundll32.exe", "shell32.dll, OpenAs_RunDLL " & $filename, "", "runas")

to get the windows run as box, but this requires to enter username and password after they have been entered into the autoit code to start up the application.

I am suggesting something like shellexecuteas() or something similar to runas() so that we can specify in the code username and password to use.

This is not going to happen. The API does not support it. What you can do, however, is use the /AutoIt3ExecuteLine feature of AutoIt. You can leverage that along with RunAs() to invoke ShellExecute() from an instance of AutoIt running as the user you want. The code would be something like:

Local Const $sAutoItExe = "Some Place UserB has access to"
Local Const $sCmd = '"ShellExecute(blah blah blah)"'
FileCopy(@AutoItExe, $sAutoItExe)
RunAsWait("UserB", "UserBpass", @ComputerName, 0, $sAutoItExe & " /AutoIt3ExecuteLine " & $sCmd)
FileDelete($sAutoItExe)

You will have some trouble with quotes, it's finicky getting them right since you must pass valid AutoIt syntax to /AutoIt3ExecuteLine and you must pass it as a SINGLE parameter (meaning the item has to be quoted itself). But basically you copy the AutoIt interpreter (A compiled script is fine) to a location UserB can access. Then you run that interpreter and have it execute your ShellExecute() line under the context of UserB. Then you clean up.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.