koons Posted September 16, 2014 Author Share Posted September 16, 2014 No, just copy/paste it in a new file and then compile it. That's what I did. But don't mind me. I simply forgot to save the .au3 before I tried compiling. I never claimed to be good at this. So I got that elevate.exe created and now when I run the other .exe I keep getting an "Unknown function name" error. I did remove the _RunAsElevate function you had suggested in a previous post, but I'm pretty sure that wouldn't have any affect on it. expandcollapse popup#pragma compile(AutoItExecuteAllowed, True) #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <file.au3> #include <array.au3> #include <GuiListView.au3> #Region ### START Koda GUI section ### Form=c:\documents and settings\andrew.mclean\my documents\scripts\idsupdater\idsupdater.kxf $IDSUpdaterForm = GUICreate("IDS Updater", 633, 447, 1584, 161) GUISetBkColor(0xA6CAF0) $IDSUpdaterTitle = GUICtrlCreateLabel("IDS Updater 2.0", 179, 24, 275, 49) GUICtrlSetFont(-1, 30, 800, 4, "Garamond") GUICtrlSetColor(-1, 0x000000) $Directions1 = GUICtrlCreateLabel("Please select the update you wish to install from the below list", 85, 104, 463, 25) GUICtrlSetFont(-1, 14, 400, 0, "Times New Roman") $Directions2 = GUICtrlCreateLabel(" and hit the Update button.", 217, 136, 203, 25) GUICtrlSetFont(-1, 14, 400, 0, "Times New Roman") GUISetState(@SW_SHOW) $AvailableUpdatesList = GUICtrlCreateListView("", 118, 165, 401, 160) GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman") GUICtrlSetCursor (-1, 0) _GUICtrlListView_AddColumn($AvailableUpdatesList,"Available updates",397) $FileList=_FileListToArray("\\domain.com\apps\IDS","*.exe") If @error=1 Then MsgBox(0,"","No folders found.") Exit EndIf If @error=4 Then MsgBox(0,"","No files found.") Exit EndIf Dim $a_lv_array[$FileList[0]][1] For $i = 1 To $FileList[0] $a_lv_array[$i - 1][0] = $FileList[$i] Next _GUICtrlListView_AddArray($AvailableUpdatesList,$a_lv_array) $UpdateButton = GUICtrlCreateButton("Update", 120, 360, 153, 41, $WS_GROUP) GUICtrlSetFont(-1, 12, 800, 0, "Times New Roman") $CancelButton = GUICtrlCreateButton("Cancel", 440, 360, 81, 41, $WS_GROUP) GUICtrlSetFont(-1, 12, 800, 0, "Times New Roman") $Directions3 = GUICtrlCreateLabel("After clicking Update, there will be a delay while file is downloading.", 110, 410, 463, 25) GUICtrlSetFont(-1, 9, 400, 0, "Times New Roman") GUISetState() #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() WinMove("IDS Updater","",100,100) Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $CancelButton Exit Case $UpdateButton Local $sUserName = "admin" Local $sDomainName = "domain.com" Local $sPassword = "secret" Local $sSelected = _GUICtrlListView_GetItemText($AvailableUpdatesList,number(_GUICtrlListView_GetSelectedIndices($AvailableUpdatesList))) If Not IsAdmin() Then RunAs($sUsername, $sDomainName, $sPassword, 0, elevate.exe "\\domain.com\apps\IDS\" & $sSelected, @WindowsDir, "") Else MsgBox(0,"Silly goose.","You're an admin. You don't need to run this.") EndIf Sleep(200) Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
MikahS Posted September 16, 2014 Share Posted September 16, 2014 Can you also post the full error message you received? Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
koons Posted September 16, 2014 Author Share Posted September 16, 2014 Link to comment Share on other sites More sharing options...
MikahS Posted September 16, 2014 Share Posted September 16, 2014 Compile your script with these at the top: #Region #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so #EndRegion This will create a .au3 stripped file like such: example_stripped.au3 You should be able to go and see what is on line 10104 in the stripped script. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
koons Posted September 16, 2014 Author Share Posted September 16, 2014 Where does it create the stripped file? Link to comment Share on other sites More sharing options...
MikahS Posted September 16, 2014 Share Posted September 16, 2014 The working directory. Should be with your .au3 file and your .exe compiled file. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
koons Posted September 16, 2014 Author Share Posted September 16, 2014 I don't see it. Link to comment Share on other sites More sharing options...
MikahS Posted September 16, 2014 Share Posted September 16, 2014 I just compiled with these directives as mentioned above. The file I used was saved on my desktop named ex.au3 #Region #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so #EndRegion As you can see after hitting F7 in the SciTE editor (compile) I got this: Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
jguinch Posted September 16, 2014 Share Posted September 16, 2014 There is an error in this line : RunAs($sUsername, $sDomainName, $sPassword, 0, elevate.exe "\\domain.com\apps\IDS\" & $sSelected, @WindowsDir, "") it must be : RunAs($sUsername, $sDomainName, $sPassword, 0, "elevate.exe \\domain.com\apps\IDS\" & $sSelected, @WindowsDir) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
koons Posted September 16, 2014 Author Share Posted September 16, 2014 Doh. Ok, so I made that little change and it runs with no errors. However, it isn't running the actual .exe that the user selects in the window I created. Link to comment Share on other sites More sharing options...
jguinch Posted September 16, 2014 Share Posted September 16, 2014 Are you sure that the specified user (in the RunAs call) has an access to the server share ? Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
koons Posted September 17, 2014 Author Share Posted September 17, 2014 Are you sure that the specified user (in the RunAs call) has an access to the server share ? Yes. I am positive. The user is a domain administrator. Link to comment Share on other sites More sharing options...
jguinch Posted September 17, 2014 Share Posted September 17, 2014 and if you try this ? RunAs($sUsername, $sDomainName, $sPassword, 0, "elevate.exe " & @WindowsDir & "\notepad.exe", @WindowsDir) Do notepad opens ? Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
koons Posted September 22, 2014 Author Share Posted September 22, 2014 and if you try this ? RunAs($sUsername, $sDomainName, $sPassword, 0, "elevate.exe " & @WindowsDir & "\notepad.exe", @WindowsDir) Do notepad opens ? Notepad did not open with that command. Link to comment Share on other sites More sharing options...
jguinch Posted September 22, 2014 Share Posted September 22, 2014 (edited) What happens when you manually launch elevate.exe from the explorer ? Are you prompted for UAC ? Edited September 22, 2014 by jguinch Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
koons Posted September 24, 2014 Author Share Posted September 24, 2014 Yes, UAC pops up. Link to comment Share on other sites More sharing options...
caramen Posted September 25, 2014 Share Posted September 25, 2014 (edited) you got a way bro. You can cript your password in your script to make it hidden so you will be able to use admin right for you script without show it to all of your users ... the only weird thing is: it take long time to code and it s a bit complicated... (For ppls like me becose i am low skilled) i got exemple of script for you if you are interesting in this but dont got time to code for you unfortunalty i dit an auto login script secured by cripted stored password and i am pretty sure you can do same with your script. EDIT: But i am open for anyhelp. (if you like that idea) Edited September 25, 2014 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Anteaus Posted September 25, 2014 Share Posted September 25, 2014 You might like to take a look at http://sf.net/projects/softwarepolicy This is basically a replacement for UAC, and works on the principle that: The user is a proper administrator LAN connections are never lost due to permissions changes All programs can be run with full rights except those specified as 'high risk' eg browsers Restrictions are set on the disk locations programs can be run from Two major advantages are overcoming the loss of LAN connections caused by UAC, which is extremely problematic for business users, and that it is not so easy to spoof the user into robotically clicking 'Yes' to a malicious elevation prompt. For software installation work, the protection can be turned off for a specified interval of time during which you won't be bothered again by prompts. You can even reboot without the status changing. At the end of the time limit the protection automatically turns itself back on, in case you forgot. Obviously not so appropriate if you are distributing your script, but for inhouse use it's a very good solution to keeping security tight without the problems raised by UAC. 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