Jump to content

#RequireAdmin: not able to execute script


Recommended Posts

Hello,

If I open the my "GUI" program and  press "Flush DNS" button it will not execute dnsflush.exe . It only works if I remove #RequireAdmin, no error message :/

 

GUI:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Test", 615, 437, 192, 124)
$FlushDNS = GUICtrlCreateButton("Flush DNS", 24, 56, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $FlushDNS
            RunWait(@ScriptDir & '\dnsflush.exe')

    EndSwitch
WEnd

 

dnsflush.exe:

#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=dnsflush.exe
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>




MsgBox(0, "Output", "test")

 

 

 

 

Edited by hendrikhe
Link to comment
Share on other sites

That will work, but in this case I could run the second script directly (it works if I dont execute from GUI).

But I want to add some buttons in this GUI later and some can be executed by a normal user and others will need admin.

And since the normal user will have access to this GUI and dont want this user executing Admin scripts.

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...