How to desinate the File location/name in MSI ArgumentList Arrary @( ….)

Welcome Forums General PowerShell Q&A How to desinate the File location/name in MSI ArgumentList Arrary @( ….)

Viewing 2 reply threads
  • Author
    Posts
    • #234304
      Participant
      Topics: 10
      Replies: 9
      Points: 24
      Rank: Member

      Rob,

      Thank you for the response. That was what I was referring too.
      I was able to get it to work mostly. Seems my issue was with another argument and not the one to call the file.
      The one cmd line switch calls for ” ” around it so in powershell it looks like this.

      "INSTALLDIR="C:\example\example folder""

      command line looks like this.

      INSTALLDIR="C:\example\example folder"

      Thanks again

    • #234223
      Participant
      Topics: 10
      Replies: 9
      Points: 24
      Rank: Member

      I am trying to setup an array to install .msi applications with powershell. The only thing that is confusing me is how to tell it the MSI name and location.
      Here is an example. The file will be located in C:\ (just an example) and the name will be test.msi
      command line arguments needed.
      /i, /qn, /norestart and file location.

      sample code

      $MSI = @(
      "/i"
      "how to set file location and name"
      "/qn"
      "/norestart"
      )
      Start-process msiexec.exe -ArgumentList $MSI -Wait

      I just don’t understand how to set the file location and name. this is of course just an example of some code.
      I found this example of an arrary

      $MSIArguments = @(
          "/i"
          ('"{0}"' -f $file.fullname)
          "/qn"
          "/norestart"
          "/L*v"
          $logFile

      The (‘”{0}”‘ -f $file.fullname) is confusing me in the post as they never explain this.

      Any help would be appreciated.

      Thank you

    • #234268
      Participant
      Topics: 12
      Replies: 1642
      Points: 2,660
      Helping Hand
      Rank: Community Hero

      Assume you are referring to:

      https://powershellexplained.com/2016-10-21-powershell-installing-msi-files/

      This is a basic example of getting the file directly:

      $file = Get-Item -Path C:\Scripts\ls.txt
      
      #or
      
      Set-Location -Path C:\Scripts
      $file = Get-Item -Path .\ls.txt
      
Viewing 2 reply threads
  • You must be logged in to reply to this topic.