Litzner Posted November 14, 2011 Share Posted November 14, 2011 I am trying to make a installer for flash. For WinXP I am injecting the Admin account, and I would like Win7 to ask for admin credentials, or run as Admin. If I enter the #RequireAdmin flag, it will no longer allow WinXP regular users to run it. So I was trying to figure out a work around. Here is my regular code - the admin credential variables. ;Check to see if user is trying to install on Win7 without Admin rights If @OSVersion == "WIN_7" And Not IsAdmin() Then ;Display error message with 5 second timeout MsgBox ( 0, "Requires Admin Rights", "Windows 7 Flash installations require administrator rights.", 5 ) Exit Else ;Check if Flash is already up to date If FileExists("C:\Windows\System32\Macromed\Flash\flash11e.ocx") Then Exit EndIf ;Creates C:\Software directory if it is not already created DirCreate ("C:\Software") ;Copies Flash un/installation files to C:\Software FileInstall("Flash32.exe", "C:\Software\Flash32.exe", 1) FileInstall("UnFlash32.exe", "C:\Software\UnFlash32.exe", 1) ;Checks if OS is WinXP If @OSVersion == "WIN_XP" Then ;Uninstall Flash Player RunAsWait($sUserName, $sNetwork, $sPassword, 4, "C:\Software\UnFlash32.exe -uninstall -force") ;Install Flash Player RunAsWait($sUserName, $sNetwork, $sPassword, 4, "C:\Software\Flash32.exe -install") ;Checks if OS is Win7 ElseIf @OSVersion == "WIN_7" Then ;Uninstall Flash Player RunWait("C:\Software\UnFlash32.exe -uninstall -force") ;Install Flash Player RunWait("C:\Software\Flash32.exe -install") EndIf EndIf Here is where I tried to have AutoIT call another AutoIT exe specifically for Flash on WIN7 that has the #RequireAdmin flag, but it does not prompt for Admin rights. ;Check if Flash is already up to date If FileExists("C:\Windows\System32\Macromed\Flash\flash11e.ocx") Then Exit EndIf ;Creates C:\Software directory if it is not already created DirCreate ("C:\Software") ;Copies Flash un/installation files to C:\Software FileInstall("Flash32.exe", "C:\Software\Flash32.exe", 1) FileInstall("UnFlash32.exe", "C:\Software\UnFlash32.exe", 1) FileInstall("FlashWin7.exe", "C:\Software\FlashWin7.exe", 1) ;Checks if OS is WinXP If @OSVersion == "WIN_XP" Then ;Uninstall Flash Player RunAsWait($sUserName, $sNetwork, $sPassword, 4, "C:\Software\UnFlash32.exe -uninstall -force") ;Install Flash Player RunAsWait($sUserName, $sNetwork, $sPassword, 4, "C:\Software\Flash32.exe -install") ;Checks if OS is Win7 ElseIf @OSVersion == "WIN_7" Then ;Install Flash Player RunWait("C:\Software\FlashWin7.exe") EndIf Anyone have any other ideas on how to get this to work? Link to comment Share on other sites More sharing options...
nergmlam Posted June 28, 2012 Share Posted June 28, 2012 Hi CTRL+F7 Select "Resource Update" Select "Execution level" Select "requireAdministrator" Select "Compile Script" You don't need to remember this, becuase now it's part of your script like this: #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator From now on your compiled exe file will always be prompted with an UAC elevation to run as administrator Sincerely J. Malmgren IT-Programmer http://www.tryware.dk 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