Jump to content

Automate software installation - need advice.


Recommended Posts

Dear fellow members,

The mid-size employer I work for has a need to automate the installation of 75 software applications.  The application are packaged with no inputs required from the users.  I created a GUI interface with application selection checkboxes to take the user's input, and upon clicking an "Install Now" button; the selected software then starts installation.  The problem I am running into is that some of the software do not register an installation process into task manager or that sometimes the tag file I look for becomes available before the installation is completed.  If that situation becomes true, then the script runs the next selected software.  This continues until one too many installation is running at the same time and crashes the process.  I have used the "If Not ProcessExists", and "If Not FileExists" but my lack of knowledge on the subject is creating challenges for me.  I may be going at this wrong, so your insight is much appreciated.  How do I create an installation sequence where one software starts installation, waits for the installation process to complete/end, and then start the next software installation?  I have included a sample code from my task sequence for review.

Thank you very much for your time and help.

Func Winzip()
    If GUICtrlRead($Checkbox2) = $GUI_CHECKED Then
        MsgBox(0, $sMsg_Title, "Preparing Winzip installation...", 5)
        If FileExists("C:\Program Files (x86)\Winzip\Winzip.exe") Then
            GUICtrlSetState($Checkbox2, $GUI_UNCHECKED)
            MsgBox(0, $sMsg_Title, "Winzp is already installed!", 5)
        ElseIf Not FileExists("C:\Program Files (x86)\Winzip\Winzip.exe") Then
            ShellExecute("\\Server1\folder1\winzip.msi")
            Do
                Sleep(1000)
            Until Not ProcessExists("setup.exe")
            GUICtrlSetState($Checkbox2, $GUI_UNCHECKED)
            MsgBox(0, $sMsg_Title, "Winzip installation is completed!", 5)
        EndIf
    ElseIf GUICtrlRead($Checkbox2) = $GUI_UNCHECKED Then
        Sleep(100)
    ElseIf @error Then
        Msgbox(0, "Error, exiting installation!")
    EndIf
EndFunc   ;==>Winzip

Func FileZilla()
    If GUICtrlRead($Checkbox3) = $GUI_CHECKED Then
        MsgBox(0, $sMsg_Title, "Preparing FileZilla installation...", 5)
        If FileExists("C:\Program Files\FileZilla FTP Client\filezilla.exe") Then
            GUICtrlSetState($Checkbox3, $GUI_UNCHECKED)
            MsgBox(0, $sMsg_Title, "Filezilla is already installed!", 5)
        ElseIf Not FileExists("C:\Program Files\FileZilla FTP Client\filezilla.exe") Then
            ShellExecute("\\Server1\folder2\FileZilla_3.28.0_win64-setup.exe")
            Do
                Sleep(1000)
            Until FileExists("C:\Program Files\FileZilla FTP Client\filezilla.exe")
            GUICtrlSetState($Checkbox3, $GUI_UNCHECKED)
            MsgBox(0, $sMsg_Title, "Filezilla installation is completed!", 5)
        EndIf
    ElseIf GUICtrlRead($Checkbox3) = $GUI_UNCHECKED Then
        Sleep(100)
    ElseIf @error Then
        Msgbox(0, "Error, exiting installation!")
    EndIf
EndFunc   ;==>FileZilla

 

Link to comment
Share on other sites

  • Moderators

Or ShellExecuteWait if you want to break up file and parameters more cleanly.

Secondly, I would think about actually using the parameters - your winzip MSI for example is going to simply launch and then sit there. If you want to do this without user intervention run it like this:

ShellExecuteWait("msiexec.exe", '/i "\\server1\folder1\winzip.msi" /qn')

 

"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

Oh my goodness, I have completely forgotten about ShellExecuteWait in my frustration with this subject.  I will test it tomorrow when back at the office.  The reason why I use ShellExecute is that I have a mixture of .exe files and .msi files.  Run or RunWait did not allow me to run .msi files.  Thank you for the insight on ShellExecuteWait.  Much appreciated!!

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