locked
Installing .msi using script but getting error message RRS feed

  • Question

  • Hello,

    I am installing Right fax client on end user's machine using PowerShell script but when I run the script I get following .msi error. 

    The Installation package could not be opened.  Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid windows installer package.  

    I did verify the access to the files and I do have full access and it is allowed to access the share.

    Here is the script. 

     

    $newinstallpackage="\\computername\d$\Rightfax\rightfax_10.5_fp1_client\Client\RightFax Product Suite - Client.msi"


    Write-Host

    $newinstallpackage


    pause


    Start-Process

    msiexec.exe-Wait-ArgumentList'/i "$newinstallpackage" REBOOT=ReallySuppress RUNBYRIGHTFAXSETUP=2 CONFIGUREFAXCTRL=1 CONFIGUREFAXUTIL=1 ADDLOCAL="FaxUtil,FaxCtrl" NETID=2 INSTALLDIR="C:\Program Files (x86)\RightFax" RFSERVERNAME="cs-fax-3.demarlogisticsinc.com"'>"C:\IT\install.log"

    Tuesday, May 16, 2017 4:33 PM

All replies

  • please do not post colorized code.  Use the code posting tool so that the code is not broken and unreadable like yours is.

    \_(ツ)_/

    Tuesday, May 16, 2017 4:38 PM
  • I'm assuming that you're trying to do this remotely, in which case your path ( $NewInstallPackage        ="\\computername\d$\Rightfax\rightfax_10.5_fp1_client\Client\RightFax Product Suite - Client.msi" ) is going to run into the double-hop issue. If that is the case for you, you will need to copy the package down to the local machine to avoid the double-hop. You will also need to use Invoke-Command for this (requires PSRemoting to be enabled, if it's not)

    If your installer package doesn't require supporting files to install you can use this Install-Package function I've developed (supports MSI, EXE, and MSP). This is also assuming that it accepts silent switches.

    function Install-Package { <# .SYNOPSIS Copies and installs specifed filepath ($Path). This serves as a template for the following filetypes: ( .EXE, .MSI, & .MSP ) .DESCRIPTION Copies and installs specifed filepath ($Path). This serves as a template for the following filetypes: ( .EXE, .MSI, & .MSP ) .EXAMPLE .\InstallAsJob (Get-Content C:\ComputerList.txt) .EXAMPLE .\InstallAsJob Computer1, Computer2, Computer3

    .NOTES

    Written by: Jeremy DeWitt aka JBear

    Date: 2/9/2017 #> param( [parameter(mandatory=$true)] [string[]]$Computername, #Installer location [parameter(mandatory=$true)] [string]$Path, #Retrieve Leaf object from $Path $FileName = (Split-Path -Path $Path -Leaf) ) #Create function function InstallAsJob { #Each item in $Computernam variable ForEach($Computer in $Computername) { #If $Computer IS NOT null or only whitespace if(!([string]::IsNullOrWhiteSpace($Computer))) { #Test-Connection to $Computer if(Test-Connection -Quiet -Count 1 $Computer) { #Static Temp location $TempDir = "\\$Computer\C$\TempPatchDir" #Final filepath $Executable = "$TempDir\$FileName" #Create job on localhost Start-Job { param($Computername, $Computer, $Path, $Filename, $TempDir, $Executable) #Create $TempDir directory New-Item -Type Directory $TempDir -Force | Out-Null #Copy needed installer files to remote machine Copy-Item -Path $Path -Destination $TempDir #If file is an EXE if($FileName -like "*.exe") { function InvokeEXE { Invoke-Command -ComputerName $Computer { param($TempDir, $FileName, $Executable) #Start EXE file Start-Process $Executable -ArgumentList "/s" -Wait #Remove $TempDir location from remote machine Remove-Item -Path $TempDir -Recurse -Force } -AsJob -JobName "Silent EXE Install" -ArgumentList $TempDir, $FileName, $Executable } InvokeEXE | Wait-Job | Receive-Job } elseif($FileName -like "*.msi") { function InvokeMSI { Invoke-Command -ComputerName $Computer { param($TempDir, $FileName, $Executable) #Start MSI file Start-Process 'msiexec.exe' "/i $Executable /qn" -Wait #Remove $TempDir location from remote machine Remove-Item -Path $TempDir -Recurse -Force } -AsJob -JobName "Silent MSI Install" -ArgumentList $TempDir, $FileName, $Executable } InvokeMSI | Wait-Job | Receive-Job } elseif($FileName -like "*.msp") { function InvokeMSP { Invoke-Command -ComputerName $Computer { param($TempDir, $FileName, $Executable) #Start MSP file Start-Process 'msiexec.exe' "/p $Executable /qn" -Wait #Remove $TempDir location from remote machine Remove-Item -Path $TempDir -Recurse -Force } -AsJob -JobName "Silent MSP Installer" -ArgumentList $TempDir, $FileName, $Executable } InvokeMSP | Wait-Job | Receive-Job } else { Write-Host "$Destination does not exist on $Computer, or has an incorrect file extension. Please try again." } } -Name "Patch Job" -Argumentlist $Computername, $Computer, $Path, $Filename, $TempDir, $Executable } else { Write-Host "Unable to connect to $Computer." } } } } InstallAsJob Write-Host "`nJob creation complete. Please use the Get-Job cmdlet to check progress.`n" Write-Host "Once all jobs are complete, use Get-Job | Receive-Job to retrieve any output or, Get-Job | Remove-Job to clear jobs from the session cache." }#End Install-Package

    If your installer requires supporting files from it's original directory some customization will be required to pull those files down into the temp directory but, that should be very easy to accomplish.




    • Edited by Average-Bear Tuesday, May 16, 2017 9:28 PM
    • Proposed as answer by Average-Bear Tuesday, May 16, 2017 11:23 PM
    Tuesday, May 16, 2017 9:12 PM