Jump to content

How to Self-Elevate a script


Epulone
 Share

Recommended Posts

Is there a way to run a script [complied (.exe)] with the admin right?

If I use:

#RequireAdmin= it will ask for the admin password

 RunAs  and RunAsWait are designed to work only if I have an external program to run (not for elevate it-self).

Thanks

 

 

 

Link to comment
Share on other sites

If RegRead('HKEY_CLASSES_ROOT\exefile\shell\runas\command', '') <> '"%1" %*' Then
      RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\exefile\shell\runas', 'HasLUAShield', 'REG_SZ', '')
      RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\exefile\shell\runas\command', '', 'REG_SZ', '"%1" %*')
      RegWrite('HKEY_CURRENT_USER\SOFTWARE\Classes\exefile\shell\runas\command', 'IsolatedCommand', 'REG_SZ', '"%1" %*')
   EndIf
   ShellExecute(@ScriptFullPath, '', StringRegExpReplace(@WorkingDir, '\\+$', ''), 'runas')

 

Link to comment
Share on other sites

Hi.

you are again asking howto bypass Windows' buildin security mechanisms.

 

#RequireAdmin= it will ask for the admin password

 

Exactly. Thats WAD (working as designed), and it's good, that it's WAD!

 

Rudi.

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to comment
Share on other sites

  • Developers
On 12/26/2018 at 6:44 PM, Epulone said:

If I use:

#RequireAdmin= it will ask for the admin password

 RunAs  and RunAsWait are designed to work only if I have an external program to run (not for elevate it-self).

Don't you think there is a reason for this that they have build it this way? ;)

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Moderators

@Epulone We just had this exact conversation at great length via PM; I don't get what you are unable to understand. You are not going to get help bypassing inherent Windows security features. Do not ask this again if you wish to stay on this forum.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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