Forum Discussion

kenhepworth's avatar
kenhepworth
Occasional Contributor
13 years ago

Unable to run .msi file

Hi,

I am attempting to run an msi file that is located on another machine, but I just don't seem to be able to run it. I run a .exe file from the same directory without any problems. It adds the application to the tested applications list, but does not want to follow on. I have also made sure that I have started TestComplete as an administrator as suggested, but still to no avail. Any advice here would be helpful. Below are the details to my issue.



I am getting the following message:

Possible reasons:

 - TestComplete is running without administrator privileges.

 - The command-line arguments specified for the application are invalid:

   [n\a]

 - The working folder path is unavailable or does not exist:

   \\stc1\customerdata\Generic 8.0\Latest Build\Setups\Latest



Here is the script that I execute in vbscript


Sub Install()


Install()

 


Set foundFiles = aqFileSystem.FindFiles("\\stc1\customerdata\Generic 8.0\Latest Build\Setups\Latest\", "XXXXXXXXX(8.*).msi")


If Not foundFiles Is Nothing Then


While foundFiles.HasNext


Set aFile = foundFiles.Next


Wend


End If


Dim FullPath, TestApp, TestAppIndex


FullPath = afile.path


' Adds the application to the collection of tested applications


TestAppIndex = TestedApps.Add(FullPath)


Log.Message("A new application has been added to the list of tested applications with the index " & TestAppIndex)


' Obtains the new tested application and changes its parameters


Set TestApp = TestedApps.Items(TestAppIndex)


' Launches the application


TestApp.Run


 



End Sub




5 Replies

  • karkadil's avatar
    karkadil
    Valued Contributor

    MSI file is not an executable file. In order to "run" it, you have to pass it as a parameter to the msiexec utility (together with /i parameter).


    Here is an example in JScript


    function RunMSI()

    {

       var MSIpath = "D:\\Install\\myfile.msi";



       if(TestedApps.Find("msiexec.exe") == -1)

       {

         TestedApps.Add("msiexec.exe", "/i " + MSIpath);

       }

       TestedApps.msiexec.Run();

    }

  • kenhepworth's avatar
    kenhepworth
    Occasional Contributor
    Hi Gennadiy,



    Thanks for that. I have managed to get a bit further now with your code. It actually logs that it starts and the msiexec gets added to the TestedApps, but what happens now is that is that I just get the Windows Installer parameters window coming up, so I am assuming that my parameters to execute my msi file are incorrect and I will have to go and talk to the developers which ones I have to use.



    I had also seen somewhere else something like this snippet used, but all it gives me is an error stating that the "installation package could not be opened". So obviously it is to do with permissions here as well.


    Set WshShell = CreateObject("WScript.Shell")


    WshShell = CreateObject("WScript.Shell")

    WshShell.Run "msiexec.exe /i Fullpath"





    Once again thanks for your help so far.



    Ken

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    What you need to make sure of is that you're passing FullPath not directly to the Run method but as a concatenation to the string..




    Set WshShell = CreateObject("WScript.Shell")




    WshShell = CreateObject("WScript.Shell")

    WshShell.Run("msiexec.exe /i " & Fullpath)
  • kenhepworth's avatar
    kenhepworth
    Occasional Contributor
    Hi Robert,



    When I applied your suggestion I got the error



    An exception occurred in the "FindDBUpgrade" unit at line 23:

    Microsoft VBScript runtime error

    Object doesn't support this property or method: 'WshShell'



    So what I did was that I removed the middle line, and I just seemed to be getting the Windows Installer information window. I just don't seem to be able to get past this point. Here is my latest piece of code. It just seems that the parameters might be incorrect. I can not get the interface that I am expecting.



    Regards,

    Ken







    Sub RunMSI()


     


    Set foundFiles = aqFileSystem.FindFiles("\\stc1\customerdata\Generic 8.0\Latest Build\Setups\Latest\", "Perenso Server DB Upgrade (8.*).msi")


    If Not foundFiles Is Nothing Then


    While foundFiles.HasNext


    Set aFile = foundFiles.NextWend


    End If


    'log.Message afile.name


    'Runs the "Perenso_8_Administrator" tested application Install


     


    Dim FullPath, TestApp, TestAppIndex


    ' Specifies the full path to an application's executable


    FullPath = afile.path


     


     


    ' Launches the application


    'Set WshShell = CreateObject("WScript.Shell")


     


    WshShell = CreateObject("WScript.Shell")


    WshShell.Run("msiexec.exe /i " & Fullpath)


     


    End Sub

  • kenhepworth's avatar
    kenhepworth
    Occasional Contributor
    In the end I worked out what it was. I had to do it this way in the end



    WshShell.Run("msiexec /i " & """" & Fullpath & """")






    and then it executed my msi.



    Thanks for your help