+ Post New Thread
Results 1 to 13 of 13
Windows Thread, Combining two .exe's in Technical; Not sure if this should be here or the coding forum, so I'm chancing here. I now have my little ...
  1. #1

    MK-2's Avatar
    Join Date
    Oct 2006
    Location
    Nottingham
    Posts
    3,237
    Thank Post
    149
    Thanked 581 Times in 307 Posts
    Blog Entries
    8
    Rep Power
    200

    Combining two .exe's

    Not sure if this should be here or the coding forum, so I'm chancing here.

    I now have my little GUI exe created that I've been working on in AutoIT.
    Some of the commands use psexec.exe so for the GUI to run properly it needs to be in the same folder as psexec.exe
    I know there are tools out there to put two exe's in to one but most are virii writing tools that hide trojans etc so a majority of AV software will now pick it up as infected.

    Basically I just want to have one exe that I can carry around. Preferably open source software if possible.

    Any ideas?

    Thanks

  2. #2

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,406
    Thank Post
    639
    Thanked 961 Times in 661 Posts
    Blog Entries
    2
    Rep Power
    324

    Re: Combining two .exe's

    You can include other files in a compiled AutoIT exe using FileInstall.

    Or you could put all the files you need in a self-extracting archive and have AutoIT run apps from the 'working directoy' once extracted.

  3. #3

    MK-2's Avatar
    Join Date
    Oct 2006
    Location
    Nottingham
    Posts
    3,237
    Thank Post
    149
    Thanked 581 Times in 307 Posts
    Blog Entries
    8
    Rep Power
    200

    Re: Combining two .exe's

    **EDIT**

    OK I got it to work with the FileInstall. But the help doesn't say anything about it deleting files after use. I don't want it leaving psexec.exe in a folder once I'm done with it.
    I guess I could tell it to delete the file as the script ends with FileDelete ()

    Thankya for the advice

  4. #4

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,406
    Thank Post
    639
    Thanked 961 Times in 661 Posts
    Blog Entries
    2
    Rep Power
    324

    Re: Combining two .exe's

    You'll have to specify the full path to the EXE when running it. Perhaps set the path in a global variable, and concatenate it in the FileInstall function and the Run function later on.

  5. #5

    MK-2's Avatar
    Join Date
    Oct 2006
    Location
    Nottingham
    Posts
    3,237
    Thank Post
    149
    Thanked 581 Times in 307 Posts
    Blog Entries
    8
    Rep Power
    200

    Re: Combining two .exe's

    Hmmm weird, I created a test script with this:

    FileInstall( "c:\pstools\psexec.exe", "",)
    MsgBox(0, "DONE", "psexec extracted" )
    FileDelete( @WorkingDir & "\psexec.exe")

    Ran it, and it extracts the exe, after I click OK it deletes it, all perfect how I want it.
    I put the install and delete lines in my script, and it goes t*ts up.
    Doesn't even extract psexec.

    I have a feeling it's probably me putting the install line in the wrong place (hopefully).
    If it works that should be that sorted.

    Thankfully I still have the old sysinternals pstools and not the MS owned ones, which I think need you to use /accepteula as a switch for every tool if you want it to run without needing to click yes each time you run it!

  6. #6

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,406
    Thank Post
    639
    Thanked 961 Times in 661 Posts
    Blog Entries
    2
    Rep Power
    324

    Re: Combining two .exe's

    Hmm okay. Not sure why that happens. :? Is the script too big to post?

  7. #7

    MK-2's Avatar
    Join Date
    Oct 2006
    Location
    Nottingham
    Posts
    3,237
    Thank Post
    149
    Thanked 581 Times in 307 Posts
    Blog Entries
    8
    Rep Power
    200

    Re: Combining two .exe's

    I think it's me being a numpty :P

    I put the install line further down and it worked. I then put the delete line just after it finishes the last script process and it worked. Only prob was then the script goes back to displaying the GUI which in turn recreates the file again

    So I think it's just a case of me moving where the lines are now so its created only after the button is pressed and deleted only after the last line executes.

  8. #8

    webman's Avatar
    Join Date
    Nov 2005
    Location
    North East England
    Posts
    8,406
    Thank Post
    639
    Thanked 961 Times in 661 Posts
    Blog Entries
    2
    Rep Power
    324

    Re: Combining two .exe's

    Okay, great stuff

    About it closing - are you using the Exit() function or not?

  9. #9

    MK-2's Avatar
    Join Date
    Oct 2006
    Location
    Nottingham
    Posts
    3,237
    Thank Post
    149
    Thanked 581 Times in 307 Posts
    Blog Entries
    8
    Rep Power
    200

    Re: Combining two .exe's

    The script is quite long, but this is the part from the teachers tab that I've just tested and works fine.

    I would offer this up for others to use, but obviously everyones network naming convention and stuff is different......

    And as you can see, I only use Exit if an error occurs and i want it to close. Once it completes successfully it goes back to the start of the script in case I need to add another:

    Code:
    ; STAFF
    	   If $msg = $button_st Then
    		FileInstall( "c:\pstools\psexec.exe", "",)
            $initial_st  = GUICtrlRead($initial_st)
            $surname_st  = GUICtrlRead($surname_st)
    		ProgressOn ( "", "Adding User to Domain...", "Please wait...", "300", "300", 16)
    				
    		$valst_1 = RunWait(@ComSpec & " /c " & "net user " & $initial_st & $surname_st & " p /ADD /DOMAIN /HOMEDIR:\\server\" & $initial_st & $surname_st & " /COMMENT:""Staff User - " & $initial_st & " " & $surname_st & """ /SCRIPTPATH:logon-st.bat", "", @SW_HIDE)
    		If $valst_1 <> 0 Then
    			MsgBox(0, "ERROR", "Error creating user.  Please check the username doesn't already exist")
    			Exit
    		EndIf
    		
    		ProgressSet( 15 )
    		
    		$valst_2 = RunWait(@ComSpec & " /c " & "psexec \\server cmd.exe /c mkdir ""c:\Users\Staff\Teacher Home\" & $initial_st & $surname_st & """", "", @SW_HIDE)
    		If $valst_2 <> 0 Then
    			MsgBox(0, "ERROR", "Error creating users home folder.  Please check users home folder doesn't already exist")
    			Exit
    		EndIf
    		
    		ProgressSet( 30 )
    		
    		$valst_3 = RunWait(@ComSpec & " /c " & "net group staff " & $initial_st & $surname_st & " /domain /add", "", @SW_HIDE)
    		If $valst_3 <> 0 Then
    			MsgBox(0, "ERROR", "Error adding user to group 'Staff'.  Please check that group '2006' exists")
    			Exit
    		EndIf
    		
    		ProgressSet( 45 )
    		
    		$valst_4 = RunWait(@ComSpec & " /c " & "xcacls ""\\server\Staff\Teacher Home\" & $initial_st & $surname_st & """ /g administrators:f;f /y", "", @SW_HIDE)
    		If $valst_4 <> 0 Then
    			MsgBox(0, "ERROR", "Error setting permissions on users home area -1-.  Please check permissions on the server")
    			Exit
    		EndIf
    		
    		ProgressSet( 70 )
    		
    		$valst_5 = RunWait(@ComSpec & " /c " & "xcacls ""\\server\Staff\Teacher Home\" & $initial_st & $surname_st & """ /g " & $initial_st & $surname_st & ":rcxd;rcxd /e", "", @SW_HIDE)
    		If $valst_5 <> 0 Then
    			MsgBox(0, "ERROR", "Error setting permissions on users home area -2-.  Please check permissions on the server")
    			Exit
    		EndIf
    		
    		ProgressSet( 90 )
    		
    		$valst_6 = RunWait(@ComSpec & " /c " & "psexec \\server net share " & $initial_st & $surname_st & "=""c:\Users\Staff\Teacher Home\" & $initial_st & $surname_st & """ /grant:everyone,full /UNLIMITED", "", @SW_HIDE)
    		If $valst_6 <> 0 Then
    			MsgBox(0, "ERROR", "Error sharing users home area.  Please check the share on the server")
    			Exit
    		EndIf
    		
    		ProgressSet( 100 )
    		ProgressOff()
    			
    		FileDelete( @WorkingDir & "\psexec.exe")
    		MsgBox(0, "", "User added successfully")

  10. #10

    MK-2's Avatar
    Join Date
    Oct 2006
    Location
    Nottingham
    Posts
    3,237
    Thank Post
    149
    Thanked 581 Times in 307 Posts
    Blog Entries
    8
    Rep Power
    200

    Re: Combining two .exe's

    The only things I can't do are:

    make 'user must change password on next logon' tickbox enabled
    change profile from local path to h:\
    move user from 'users' OU to a specific one for the yeargroup.

    I know these can be done in VB, but when I tried a VB 2 AU3 converter it didn't work properly

  11. #11
    fooby's Avatar
    Join Date
    Dec 2005
    Posts
    351
    Thank Post
    0
    Thanked 5 Times in 4 Posts
    Rep Power
    19

    Re: Combining two .exe's

    I have just recently started learning VB6 and have found it pretty powerful in some toys I have made for active directory. How come you chose AutoIT over VB?

    fooby

  12. #12

    MK-2's Avatar
    Join Date
    Oct 2006
    Location
    Nottingham
    Posts
    3,237
    Thank Post
    149
    Thanked 581 Times in 307 Posts
    Blog Entries
    8
    Rep Power
    200

    Re: Combining two .exe's

    fooby:

    a week or so ago i asked for some help on creating a GUI to add users as we currently use a batch file.
    somebody suggested autoit for doing it so i gave it a look and it's been useful so i carried on with it.
    i didn't really choose it over VB as i had no experience with either, it was just suggested to me and i kept with it.

    AutoIT is still powerful in its own right, and until the time comes that I reach its limits (doubtful :P ) I'll stick with it


  13. #13
    fooby's Avatar
    Join Date
    Dec 2005
    Posts
    351
    Thank Post
    0
    Thanked 5 Times in 4 Posts
    Rep Power
    19

    Re: Combining two .exe's

    Cool Thanks - I have used autoIT a little bit, but found making a GUI app in VB a lot quicker. I have built a new active directory toy recently and it works well

    I think with autoit if it doesnt do it there is some extension that adds the bits you need

    fooby

SHARE:
+ Post New Thread

Similar Threads

  1. Combining a Cisco PIX and ISA Firewall
    By flyinghaggis in forum Wireless Networks
    Replies: 12
    Last Post: 3rd April 2006, 09:31 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •